Skip to content

Instantly share code, notes, and snippets.

@frankchang0125
Last active September 19, 2018 16:05
Show Gist options
  • Save frankchang0125/28ce2e609d3ebf464cf0af18de14d4c8 to your computer and use it in GitHub Desktop.
Save frankchang0125/28ce2e609d3ebf464cf0af18de14d4c8 to your computer and use it in GitHub Desktop.
338. Counting Bits
Decimal Binary Num of 1s
0 0 0
1 01 1
2 10 1
3 11 2
4 100 1
5 101 2
6 110 2
7 111 3
8 1000 1
9 1001 2
10 1010 2
11 1011 3
12 1100 2
13 1101 3
14 1110 3
15 1111 4
16 10000 1
17 10001 2
18 10010 2
19 10011 3
20 10100 2
21 10101 3
22 10110 3
23 10111 4
24 11000 2
25 11001 3
26 11010 3
27 11011 4
28 11100 3
29 11101 4
30 11110 4
31 11111 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment