Happy Number - Two Pointers / Advanced

https://algo.monster/problems/happy_number

The example 2 is wrong.
4^2 + 2^2 is not 18, it is 20.

Thank you for pointing out. We’ve fixed it.

Can someone explain how the time complexity is O(n) ?