According to the answer key, the answer is O(N). I didn't have enough time to see it carefully. I thought it was i++ and not i/=2 in the first loop so I wrote O(N^2). But now I am not sure what is the correct. I think it should be O(log n * log n).
Code:
int count = 0;
for (int i = N; i > 0; i /=2)
for (int j = 0; j < i; j++)
count++;
Image:
