摘要:
想到了提前判断和小于0的情况,懒得写,果然被阴间用例10万个加油站坑了。 class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: #1 n = len(gas) if n ==1: i 阅读全文
摘要:
坑真的很多,首先要处理全零reduce没有值typeerror的问题。 class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: total=reduce(mul, nums) ret =[] if tota 阅读全文
摘要:
有点意思,比想的要难。 错误思路 from typing import List from collections import Counter import time class Solution: def jump(self, nums: List[int]) -> int: max_reach 阅读全文
摘要:
写了一个符和直觉的递归,时间超限了。 from typing import List import time class Solution: def canJump(self, nums: List[int]) -> bool: if len(nums) == 1: return True retu 阅读全文
摘要:
```Python#202506113 update import os root_dir = r"D:\Dir" old = "https://www.google.com/" new = "https://m.google.com/" for root, _, files in os.walk( 阅读全文
摘要:
Success Details Success Runtime: 36 ms, faster than 80.76% of Python3 online submissions for Implement strStr(). Memory Usage: 13.9 MB, less than 12.3 阅读全文
摘要:
Success Details Success Runtime: 52 ms, faster than 8.08% of Python3 online submissions for Remove Element. Memory Usage: 13.8 MB, less than 6.06% of 阅读全文