Loading problem…
You're implementing a circular last-mile route for delivery scooters. Each checkpoint gives energy, and moving to the next checkpoint consumes energy.
You are given:
gas[i]: energy gained at checkpoint icost[i]: energy required to move from i to (i + 1) % nReturn the index of a checkpoint where the scooter can start with an empty battery and complete one full loop. If no such start exists, return -1.
If a valid start exists, treat it as unique for this problem.
Determine whether a complete loop is feasible and find the correct start index.