摘要: 回溯法 思路: 参考77.组合 代码: class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: def process(path=[],begin=0): if len(path) == k: res.append 阅读全文
posted @ 2020-06-13 15:23 nil_f 阅读(157) 评论(0) 推荐(0)
摘要: 回溯法 思路: 通过回溯的思维,递归调用枚举出所有可能。 代码: class Solution: def combine(self, n: int, k: int) -> List[List[int]]: def process(begin,path): if len(path) == k: res 阅读全文
posted @ 2020-06-13 13:41 nil_f 阅读(132) 评论(0) 推荐(0)