Sort by

recency

|

2055 Discussions

|

  • + 0 comments

    Admin or @ikbalkazar, please correct the problem description.

    In query 1 and query 2:

    from:

    idx = (x ^ lastAnswer)

    to:

    idx = (x ^ lastAnswer) % n

  • + 0 comments

    i think they forgot to mention for index computation it should be moudulos of n

    for query 1 it should be

    idx = (x ^ lastAnswer) % n

    for query 2

    idx = (x ^ lastAnswer) % n

    gguys with this you can try yoursself

  • + 0 comments

    I figured out that the question phrasing is poor and not consistent, since care needs to be taken to modulo index, otherwise lastAnswer becomes bigger than array bounds, Python 3 code:

    def dynamicArray(n, queries):
        arr = [[] for _ in range(n)]
        lastAnswer = 0
        answers = []
        for q_type, x, y in queries:
            idx = (x ^ lastAnswer) % n
            if q_type == 1:
                arr[idx].append(y)
            elif q_type == 2:
                lastAnswer = arr[idx][y % len(arr[idx])]
                answers.append(lastAnswer)
        return answers
    
  • + 0 comments

    The instructions say one thing about how to calculate the idx and the example shows another thing which is confussing

  • + 0 comments

    This question literally suck my time ,and this is none to improve your DSA skill other making you chaotic ,so better move on to the next problem.

    DSA is some thing to kindle your thought beyond the given question,but here the provided essesntials are unclear.