N-th Gray Code — Solution & Editorial
The closed form is G(N) = N ⊕ (N >> 1) — prove by induction on the reflection construction.
Complexity: O(1)
The closed form is G(N) = N ⊕ (N >> 1) — prove by induction on the reflection construction.
Complexity: O(1)