time O(n) space O(1)  One travel