Xor-sequence

  • + 0 comments

    tl;dr: do not generate array, search for patterns.

    If you want to get the whole array then the answer is... you can't :( It can be up to 10^15 long and it's to much for computer. And even then, every question can be in form 1 10^15 so you would have to spen "10^15 time" on single question and that's definitely too much.

    What you should do instead is to look at the properties of the xor, maybe try to write a little bit of both arrays on paper and search for patterns.

    Imho it's pretty tough task. I'm by no means like those great coders in top100, but I think I'm getting decent at it and it took me some time to get this problem completely solved. Maybe you should get to the "bit manipulation" problems in algorithms domain first and then come back after few ACs.