curr_gain, total_gain, and answer to 0.gas and cost arrays.
a. For each station i, calculate the net gain gain[i] = gas[i] - cost[i].
b. Add gain[i] to both curr_gain and total_gain.
c. If curr_gain becomes negative, set answer to i + 1 and reset curr_gain to 0.total_gain is non-negative.
a. If yes, return answer.
b. If no, return -1.