Time Complexity

Can anyone please tell me why the hell time complexity of following code is O(n) Link is given below
: undefined - undefined - LeetCode