Given two integer arrays fuel_supply and travel_cost, each of length n, representing a circular route of n nodes. At node i, you can collect fuel_supply[i] units of fuel, and it requires travel_cost[i] units of fuel to move from node i to node (i+1) mod n. Starting with an empty tank at any node, determine the index of the node from which you can complete a full circuit in the clockwise direction without running out of fuel. If no such starting node exists, return -1. The solution is guaranteed to be unique if it exists.
Example 1
Input: fuel_supply = [5,1,2,3,4], travel_cost = [4,4,1,5,1]
Output: 4
Explanation: Start at node 4. Collect 4 fuel. Move to node 0 (cost 1, tank 3). Collect 5 (tank 8). Move to node 1 (cost 4, tank 4). Collect 1 (tank 5). Move to node 2 (cost 4, tank 1). Collect 2 (tank 3). Move to node 3 (cost 1, tank 2). Collect 3 (tank 5). Move to node 4 (cost 5, tank 0). Circuit completed.
Example 2
Input: fuel_supply = [2,2,2], travel_cost = [3,3,3]
Output: -1
Explanation: Total fuel is less than total cost, so circuit is impossible.
Constraints
Case 1
Input: fuel_supply = [6,3,7,4], travel_cost = [5,4,3,6]
Expected: 2
Case 2
Input: fuel_supply = [1,2,3,4], travel_cost = [2,2,2,2]
Expected: 2
Case 3
Input: fuel_supply = [10,0,0,0], travel_cost = [1,2,3,4]
Expected: 0
Case 4
Input: fuel_supply = [3,3,4], travel_cost = [4,4,3]
Expected: -1