Can someone please help me solve this [problem](https://codeforces.net/gym/101992/problem/J).↵
I came up with the following observations:↵
↵
1) the first bit of the binary number should be 1.↵
↵
2) we can think of each binary prefix(modulo n) as a node of the graph. So finally we need to find a hamiltonian cycle starting at 0 and ending at 0 where each node has an outgoing edge to the nodes (2*node)%n and (2*node+1)%n.↵
↵
I am unable to progress further. Any help/hint will be really helpful.
I came up with the following observations:↵
↵
1) the first bit of the binary number should be 1.↵
↵
2) we can think of each binary prefix(modulo n) as a node of the graph. So finally we need to find a hamiltonian cycle starting at 0 and ending at 0 where each node has an outgoing edge to the nodes (2*node)%n and (2*node+1)%n.↵
↵
I am unable to progress further. Any help/hint will be really helpful.