← ALL NOTES
Math

89. Gray Code

There's a closed form and it collapses the whole problem to one line: the i-th Gray code value is i ^ (i >> 1). That's the binary-reflected Gray code, and the formula guarantees consecutive values…

Loading…