摘要: 想到了提前判断和小于0的情况,懒得写,果然被阴间用例10万个加油站坑了。 class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: #1 n = len(gas) if n ==1: i 阅读全文
posted @ 2024-07-07 23:28 夜歌乘年少 阅读(9) 评论(0) 推荐(0)
摘要: 坑真的很多,首先要处理全零reduce没有值typeerror的问题。 class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: total=reduce(mul, nums) ret =[] if tota 阅读全文
posted @ 2024-07-07 19:31 夜歌乘年少 阅读(22) 评论(0) 推荐(0)