XOR key Discussions | Algorithms | HackerRank
  • + 0 comments

    https://pastebin.com/51RRGvGL Do check my code for any doubts regarding this question simply using a trie solved this question. Just maintain a vector at every node whose number indexes are on the way and check whether to take such path there exists a number in range l to r using a lower_bound if there continue such maximum path or else the other. {all those indexes of numbers will be sorted because of the increasing way of adding these numbers to trie} Max Space and time:O(16*N)