Search
⌘K

Leetcode 1238. Circular Permutation in Binary Representation

Generate any cyclic n-bit Gray-code ordering of all numbers 0..2^n-1 that starts with start, i.e., a permutation where each adjacent pair (including last→first) differs by exactly one bit. Constraints: 1 ≤ n ≤ 16 so the sequence length is 2^n.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.