Gray Code
Medium
Bit Manipulation
Print an n-bit Gray code sequence as integers: it starts at 0, has 2^n values, consecutive values differ in exactly one bit, and (for this problem) is the standard reflected sequence i XOR (i >> 1).
Constraints
1 <= n <= 16
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.