leetcode
leetcode copied to clipboard
Problem in p35 - Gas station
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.
Sorry, % is unnecessary here, by further analysis.