摘要: 左括号才能放右括号,参考他人答案。 class Solution: def generateParenthesis(self, n: int) -> List[str]: res = [] def dfs(tmp, left, right): if len(tmp) == 2 * n: res.ap 阅读全文
posted @ 2021-06-25 17:41 泊鸽 阅读(81) 评论(0) 推荐(0)
摘要: 逐个遍历字典,逐个匹配 class Solution: def letterCombinations(self, digits: str) -> List[str]: if not digits: return [] dic = {'2':['a','b','c'], '3':['d','e','f 阅读全文
posted @ 2021-06-25 17:26 泊鸽 阅读(138) 评论(0) 推荐(0)
摘要: 不会,暂时先抄一下。 主要是四领域置零直至领域无1,递归 class Solution: def numIslands(self, grid: List[List[str]]) -> int: counter = 0 for i in range(len(grid)): for j in range 阅读全文
posted @ 2021-06-25 16:22 泊鸽 阅读(174) 评论(0) 推荐(0)