Monday, February 25, 2013

Given n, output the numbers from 0 to 2^n-1 (inclusive) in n-bit binary form, in such an order that adjacent numbers in the list differ by exactly 1 bit.

Source : Heard from Rahul, CSE, BITS ,2K10

No comments :