摘要: class Solution: """ 只要总和是大于 0 的那么就一定可以找到这样的点, 可以用数学归纳法进行证明 """ def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: if not gas: retur 阅读全文
posted @ 2021-08-08 23:16 茫茫碧落 阅读(57) 评论(0) 推荐(0)
摘要: class Solution: def cloneGraph_2(self, node, relation_dict): if node in relation_dict: return tmp = Node(val=node.val) relation_dict[node] = tmp for i 阅读全文
posted @ 2021-08-08 20:14 茫茫碧落 阅读(54) 评论(0) 推荐(0)
摘要: ##动态规划 easy, 但是速度好像比较慢 ` class Solution: def is_palindrome(self, s): return s[::-1] == s def partition_2(self, s, index, result_dict): tmp = [] for i 阅读全文
posted @ 2021-08-08 00:25 茫茫碧落 阅读(39) 评论(0) 推荐(0)