반응형
For a = 2 and b = 7, the output should be |
code>>
int rangeBitCount(int a, int b) {
auto count = 0;
for (int i = a; i <= b; ++i)
{
std::bitset<4> bit(i);
count += bit.count();
}
return count;
}
반응형
'알고리즘 > codefights' 카테고리의 다른 글
18>arrayPacking (0) | 2021.04.17 |
---|---|
17>Kill K-th Bit (0) | 2021.04.17 |
Challenge>formatString (0) | 2019.03.06 |
Challenge>fibonacciIndex (0) | 2019.03.06 |
16>metroCard (0) | 2019.02.24 |