loop for each bit
while ( num_of_bits >= 0 ) { if ( N & ( 1 << num_of_bits ) ) r . append ( "1" ) ; else r . append ( "0" ) ; num_of_bits -- ; } return r ; } vector < string > NBitBinary ( int N ) { vector < string > r ; int first = 1 << ( N - 1 ) ; int last = first * 2 ;