Problems > All Gray Codes > Editorial

All Gray Codes — Solution & Editorial

Back to the Problem

The i-th Gray code is i ⊕ (i >> 1); format each with leading zeros.

Complexity: O(2N · N)