EXERCISE 1 QUESTION TO FIND TIME COMPLEXITY

How do we know that this k will lie between 1 to N-1. It might lie after N.

It is given that k < N.