Greedy algorithm to solve gas station problem