LC 134 — Problem

There are n gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] to travel from station i to the next. Return the starting gas station index if you can travel around the circuit once clockwise, otherwise return -1.

Input: gas = 12345, cost = 34512
Output: 3

Constraints: If a solution exists, it is guaranteed to be unique.

Five gas stations sit on a circular road. Each station gives you some fuel, and each leg of the road burns some. Pick a station to start from and see if you can make it all the way around.

Tap a station to start your drive.