![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode_DFS
想当厨子的程序媛
前期追深度,否则会华而不实,后期追广度,否则会坐井观天;
展开
-
Leetcode——733. Flood Fill
题目原址https://leetcode.com/problems/flood-fill/description/题目描述给定一个二维数组image,以及数组中的一个坐标,其中sr为行,sc为列,表示将给定的二维数组位置的元素更改为newColor值,并且将该位置元素(image[sr][sc])的四邻域位置上与image[sr][sc]原始值相同的元素也更改为newColor。四邻域...原创 2018-06-12 15:55:45 · 703 阅读 · 0 评论 -
Leetcode——841. Keys and Rooms
题目原址https://leetcode.com/problems/keys-and-rooms/description/解题思路经典DFS题AC代码class Solution { public boolean canVisitAllRooms(List<List<Integer>> rooms) { boolean[] r...原创 2018-06-12 17:07:08 · 700 阅读 · 0 评论 -
Leetcode——513. Find Bottom Left Tree Value
题目原址https://leetcode.com/problems/find-bottom-left-tree-value/description/题目描述Given a binary tree, find the leftmost value in the last row of the tree. Example 1:Input: 2 / \ 1...原创 2018-06-12 17:27:06 · 158 阅读 · 0 评论 -
Leetcode——515. Find Largest Value in Each Tree Row(Queue解法)
题目原址https://leetcode.com/problems/find-largest-value-in-each-tree-row/description/题目描述You need to find the largest value in each row of a binary tree. Example:Input: 1 ...原创 2018-06-12 17:38:34 · 181 阅读 · 0 评论 -
Leetcode——529. Minesweeper
题目原址https://leetcode.com/problems/minesweeper/description/题目描述这是一个简单的扫雷题给定一个二维数组,数组中包含字符M、E和空字符等,其中如果是字符M则表明该点为雷点,click为点击的二维数组的位置,click[0]表示横坐标,click[1]表示纵坐标。如果点击的是雷点M则将该点变为X然后返回结束扫雷。如果...原创 2018-06-12 18:40:34 · 532 阅读 · 0 评论 -
Leetcode——547. Friend Circles
题目原址https://leetcode.com/problems/friend-circles/description/题目描述Example 1:Input: [[1,1,0], [1,1,0], [0,0,1]]Output: 2Explanation:The 0th and 1st students are direct friends, so they ...原创 2018-06-13 11:11:26 · 258 阅读 · 0 评论 -
Leetcode——638. Shopping Offers
题目原址https://leetcode.com/problems/shopping-offers/description/题目描述Example 1: Input: [2,5], [[3,0,5],[1,2,10]], [3,2] Output: 14 Explanation: There are two kinds of items, A and B...原创 2018-06-17 21:33:34 · 286 阅读 · 0 评论