Gas station loop

Write codeMedium25 minAmazon style

Your task

There are stations arranged in a circle; gas[i] is the fuel available at station i and cost[i] is the fuel needed to drive from station i to the next. Starting with an empty tank at some station, return the starting index from which you can complete the full loop, or -1 if impossible. If a solution exists it is unique. Both lists have equal length and at least one element.

Examples

gas_station(gas: list[int], cost: list[int]) -> int
Example 1
Inputgas_station([1, 2, 3, 4, 5], [3, 4, 5, 1, 2])
Output3