Skip to content

Commit 20469fd

Browse files
Added day28 solution
1 parent 631db59 commit 20469fd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution {
2+
public:
3+
vector<int> countBits(int num) {
4+
vector<int> bits(num+1, 0);
5+
for(int i = 1; i <= num; i++) bits[i] += bits[i>>1] + i&1;
6+
return bits;
7+
}
8+
};

0 commit comments

Comments
 (0)