Incorrect test case


  • 0
    A

    The trivial case when there is only one station should not return -1 as th person does not have to move. Currently OJ gives answer depending on the difference of cost and gas at the station.


  • 0

    @amandeepgautam5 said in Incorrect test case:

    does not have to move

    How do you " travel around the circuit once" without moving?


  • 0
    A

    That's the point, you do not need move. The condition: "travel around the circuit once" is trivially satisfied. Anyway the answer to n=1 case should be irrespective of how much gas and cost we have at the station. Or either explicitly say that n is at least 2 as it does not make sense to go from city 1 to city 1.


  • 0

    @amandeepgautam5 said in Incorrect test case:

    The condition: "travel around the circuit once" is trivially satisfied.

    No it isn't.

    You seem to think that the objective is to visit the gas stations. It's not.


Log in to reply
 

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