Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 89. Gray Code
Generate any sequence of 2^n distinct integers in [0, 2^n-1] starting at 0 such that consecutive numbers (and the first and last) differ by exactly one bit—equivalently, produce a Hamiltonian cycle/traversal of the n-dimensional hypercube. Constraint: 1 ≤ n ≤ 16 (output length 2^n).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.