leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

Problem in p35 - Gas station

Open vendisky opened this issue 10 years ago • 1 comments

Line 16: return total>=0 ? j+1 : -1 Should be (j+1)%gas.size(), so that we will return 0 instead of N in some cases.

vendisky avatar Feb 11 '15 01:02 vendisky

Sorry, % is unnecessary here, by further analysis.

vendisky avatar Feb 23 '15 15:02 vendisky