Optimal Algorithmic Approach
Single-pass greedy: reset starting point when tank runs out.
Core Invariants & Edge Cases
- If total gas < total cost, no solution
- Track current tank; if it goes negative, reset and try next station as start
- The last candidate start after full scan is the answer