Problem 1238 · Medium

Circular Permutation in Binary Representation

Use the reflected Gray code and XOR it with start, so consecutive values, including the wrap, differ by one bit.

Open the interactive visualisation