题目:

Golang | Leetcode Golang题解之第134题加油站插图

题解

func canCompleteCircuit(gas []int, cost []int) int {
    for i, n := 0, len(gas); i < n; {
        sumOfGas, sumOfCost, cnt := 0, 0, 0
        for cnt  sumOfGas {
                break
            }
            cnt++
        }
        if cnt == n {
            return i
        } else {
            i += cnt + 1
        }
    }
    return -1
}
本站无任何商业行为
个人在线分享 » Golang | Leetcode Golang题解之第134题加油站
E-->