This is the 8th episode of this "note" series. I will write notes on problems (normally around 2500-ish problems), that are both interesting and educational. I normally will spend a few hours on each problem, so can I please have an **upvote** plssss.

**Difficulty rating**

**Tags**

### Problem paraphrased：

You are given an integer $$$N$$$.

You would need to start from node $$$0$$$, visit every other node once and end at node $$$0$$$ again.

When we reach node $$$i$$$, we can only go to $$$(2*i)$$$ $$$mod$$$ $$$N$$$ or $$$(2*i + 1)$$$ $$$mod$$$ $$$N$$$.

Print a cycle that contains all $$$N$$$ nodes and starts and ends at node $$$0$$$.

**Hint 1**

**Hint 2**

**Solution**

Here is the proof for Hint 1.

**proof of Hint 1**