Arrange binary number such that consecutive differ in only one bit [closed]

  bit, c++

given all binary numbers of n digits in sorted order then how to arrange them such that each consecutive elements differ in only a bit.

for eg :- 00 01 10 11
this into this :- 00 01 11 10

Source: Windows Questions C++

LEAVE A COMMENT