Problem : Can you read this?

is this good approach or not ?, passed all test cases but evaluate my solution

@dhairya16 your solution’s complexity is O(N) which is the best possible in this case , so yes your approach is correct.

please tell me, why you used while loop