Skip to main content
mediumNeetCode 150

Gas Station

Given gas available and cost to travel, find starting station Return index of starting station, or -1 if impossible Example: gas=[1,2,3,4,5], cost=[3,4,5,1,2] => 3

Gas Station looks straightforward, but it quietly checks whether you reach for the right lookup structure. Interviewers love it because it reveals your data-structure instincts and your edge-case discipline. The signal here is clean bookkeeping: know what you record and when you update it.

Arrays & HashingGreedy

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Gas Stationmedium
Based onLeetCode