134.gas-station

math question, runtime 82.13 %

Xu LIANG
LeetCode Cracker
1 min readApr 6, 2019

--

Solution 1:

This question is actually a math question. We have to know this:

If sum(gas) — sum(cost) > 0, there must have a start point to travel over the circuit. Otherwise, there is no such start point.

--

--

Xu LIANG
LeetCode Cracker

I’m an engineer focusing on NLP and Data Science. I write stuff to repay the engineer community. You can find me on linkedin.com/in/xu-liang-99356891/