Definition at line 5 of file main.cpp.
◆ countBits()
| vector< int > Solution::countBits |
( |
int |
n | ) |
|
|
inline |
Definition at line 8 of file main.cpp.
9 {
10 vector<int> answer(n + 1, 0);
11
12 for (int i = 0; i <= n; ++i)
13 answer[i] = answer[i >> 1] + (i & 1);
14
15 return answer;
16 }
Referenced by main().
The documentation for this class was generated from the following file: