Sort by

recency

|

2053 Discussions

|

  • + 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.

  • + 0 comments

    The problem description was quite unclear, and it took me nearly an hour just to grasp what was being asked—eventually, I had to give up.

    It's important not to waste too much time on poorly defined tasks, and there's no need to feel discouraged if you're unable to solve them.

    Sometimes, the issue lies in the way the problem is presented, not in your ability to solve it.

  • + 0 comments

    horrible question. If you are reading this, lemme try to clarify. queries are in the format [type, x, y] and the problem incorrectly defines idx at the top, its supposed to be idx = (x ^ lastAnswer) % n .