dfs
HELLO_蓝猫
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode 863. All Nodes Distance K in Binary Tree
解法:便利所有除了目标节点分支的节点,标记他们的爸爸和自己是左是右。然后从目标节点向外便利。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val...原创 2018-07-07 22:03:20 · 749 阅读 · 0 评论 -
Leetcode 200. Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume...原创 2018-09-03 15:13:49 · 142 阅读 · 0 评论 -
Leetocde 221. Maximal Square
一个深度优先,最开始错误在想减少时间设置了visit数组,访问的不在访问,但实际是不对的。比如:[["0","0","0","1"],["1","1","0","1"],["1","1","1","1"],["0","1","1","1"],["0","1","1","1"]]后来老老实实做时间空间也都很好。Runtime: 20 ms, faster than 97.16% of...原创 2019-05-14 11:10:26 · 192 阅读 · 0 评论
分享