WHILE_CMPL

What is the time complexity of the following code :

        int a = 0, i = N;
        while (i > 0) {
            a += i;
            i /= 2;
        }
Hints
  • Solution Approach
  • Complete Solution
46649 successful submissions.
Click here to jump start your coding interview preparation