Time complexity for question 1

int count = 0;
for (int i = N; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count++;

Shouldn’t the time complexity be something greater than N as it involves nested loop

@vikrantwaje96 No please look at this proof.
For a input integer n, the innermost statement is executed following times.

n + n/2 + n/4 + … 1

So time complexity T(n) can be written as

T(n) = O(n + n/2 + n/4 + … 1) = O(n)

The value of count is also n + n/2 + n/4 + … + 1