Example 3 of 7th video in time and space complexity

I did not understand the third question, can you give a brief of the answer. How do we reach to O(n)?

hello @satyajitsriram could you please share the code so that we can discuss about the time complexity .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.