gas station, an O(n) solution