Skip to content

134. Gas Station

-   -   -   -   -   -   -   -
        i           j
  • conclusion: Assume that i can reach j at the farthest. We should consider j+1 next time.

Why do the stations between i and j no longer need to be considered?

Let's illustrate this using proof by contradiction.

Assume that i+1 meets the requirements and it can complete a circle.
At first wo move from i to i+1, and then from i+1 to j+1 So we can reach j+1 from i.
But i only can reach j. There's contradiction and the proof is complete.

基于 VitePress 构建