Challenge: Big O of Nested Loop With Subtraction

Compute the Big O of an algorithm which involves nested loops, where the loop variables decrease with each subtraction.

We'll cover the following

Problem statement

Let’s test our time complexity skills. Compute the Big O time complexity of the code snippet given below. It is better to solve it on a piece of paper and then see if your answer matches with the correct option.

Code snippet

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.