摘要: 题目描述: 方法一:回溯 class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: res = [] def helper(k,n,start,tmp): if k==0: if n==0: res.a 阅读全文
posted @ 2019-10-03 17:00 oldby 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:堆排序* class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: def adjust_heap(idx, max_len): left = 2 * idx + 1 right = 2 * 阅读全文
posted @ 2019-10-03 16:20 oldby 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交: class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: indegree = [0 for _ in range(numCourse 阅读全文
posted @ 2019-10-03 16:04 oldby 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:双指针 O(N) class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: left = 0 res = float('inf') sum = 0 for i in range(len(nu 阅读全文
posted @ 2019-10-03 11:17 oldby 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def findMaximumXOR(self, nums: List[int]) -> int: root = TreeNode(-1) for num in nums: cur_node = root #当前的node for i in ra 阅读全文
posted @ 2019-10-03 09:50 oldby 阅读(389) 评论(0) 推荐(0) 编辑