You are viewing a single comment's thread. Return to all comments →
def dynamicArray(n, queries): answers = [0] arr = [[] for i in range(n)] for q in queries: idx = (q[1] ^ answers[-1]) % n if q[0] == 1: arr[idx].append(q[2]) else: answers.append(arr[idx][q[2] % len(arr[idx])]) return answers[1:]
Seems like cookies are disabled on this browser, please enable them to open this website
Dynamic Array
You are viewing a single comment's thread. Return to all comments →