LOOP_CMPL2

What is the time complexity of the following code :

    int i, j, k = 0;
    for (i  = n/2; i <= n; i++) {
        for (j = 2; j <= n; j = j * 2) {
            k = k + n/2;
        }
    }
Hints
  • Solution Approach
  • Complete Solution
24586 successful submissions.
Click here to jump start your coding interview preparation