Any hint how to find count of setbits from 1 to n ?
Playing with bits
Yes for each number you can find the number of set bits in any number n in log(n) time using builtin_popcount(i) and total time would be n*log(n).
Any hint how to find count of setbits from 1 to n ?
Yes for each number you can find the number of set bits in any number n in log(n) time using builtin_popcount(i) and total time would be n*log(n).