Skip to the content.

Time Complexity O(n)

Space Complexity O(1)