NeetCode #783LC-134MediumGreedyNC 150NC 250
← Back to All Problems

#783 · #134 · Gas Station(加油站)

📌 Problem Statement & Constraints

There are n gas stations in a circle; gas[i] is the fuel available and cost[i] is the fuel to travel to the next station. Starting with an empty tank, return the index of the station to start from to complete the circuit, or -1 if impossible. The answer is unique when it exists. Constraints: 1 <= n <= 10^4, 0 <= gas[i], cost[i] <= 10^4.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!