NESTED_CMPL

What is the time, space complexity of following code :

    int a = 0, b = 0;    
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            a = a + j;
        }
    }
    for (k = 0; k < N; k++) {
        b = b + k;
    } 
Hints
  • Solution Approach
  • Complete Solution
36803 successful submissions.
Click here to jump start your coding interview preparation