DFS
Minkowski_lin
这个作者很懒,什么都没留下…
展开
-
LeetCode695 岛屿的最大面积(DFS)
LeetCode695 岛屿的最大面积(DFS)class Solution: def __init__(self): self.tmp = 0 def maxAreaOfIsland(self, grid: 'List[List[int]]') -> 'int': w = len(grid) h =len(grid[0]...原创 2019-02-25 17:31:05 · 286 阅读 · 0 评论 -
LeetCode104 二叉树的最大深度(DFS)
LeetCode104 二叉树的最大深度(DFS)DFS递归# Definition for a binary tree node.class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Noneclass Solutio...原创 2019-02-25 17:47:19 · 204 阅读 · 0 评论 -
LeetCode46. 全排列 两种方法:(DFS) + (import itertools)
LeetCode46. 全排列(DFS)class Solution: def __init__(self): self.v = None self.n = None self.tmp = [] self.ans = [] def permute(self, nums): self.n = len(...原创 2019-02-25 23:53:54 · 281 阅读 · 0 评论 -
LeetCode47. 全排列 II:(DFS) + (import itertools)
LeetCode47. 全排列 II:(DFS) + (import itertools)class Solution: def __init__(self): self.n = None self.v = None self.tmp = () self.tmp_ans = [] def permuteUnique...原创 2019-02-26 00:36:03 · 152 阅读 · 0 评论 -
LeetCode112.路径总和
LeetCode112.路径总和version 1# Definition for a binary tree node.class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Noneclass Solution: ...原创 2019-02-27 09:46:06 · 122 阅读 · 0 评论 -
LeetCode337. 打家劫舍 III(DFS记忆化搜索)
LeetCode337. 打家劫舍 III(DFS记忆化搜索)# Definition for a binary tree node.class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Noneclass Solution:...原创 2019-03-24 18:55:40 · 294 阅读 · 0 评论