Why input [2,4], [3,4] expect answer -1

  • 0

    We can exactly travel from gas station 1 to gas station 0.

  • 0

    Obviously you can't complete the circle no matter from which station you start.
    You can't arrive station[1] if you start from station [0] because the gas is not enougth(2-3=-1),
    You can arrive station[0] if you start from station[1], but when you arrive station[0], you have nothing, then you would run out of gas on the way from station[0] to station[1], ^_^

  • 0

    must CIRCUIT the loop.
    CIRCUIT means 1 to 0, 0 to 1; The path 1 to 0 does not circuit the loop.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.