码迷,mamicode.com
首页 >  
搜索关键字:surrounded    ( 192个结果
[Coding Made Simple] Maximum Subsquare surrounded by 'X'
Given a 2D matrix where every element is either ‘O’ or ‘X’, find the largest subsquare surrounded by ‘X’. Examples: Solution 1. O(N^4) runtime. Consid ...
分类:其他好文   时间:2017-08-19 10:53:45    阅读次数:174
130. Surrounded Regions
矩阵的bfs, 套路一致,从外向内, 很easy 构造类, 遍历矩阵建立图 bfs要点在于如何建图, 是否建类, 建比较器, 建方向容器, 建走过的路的存储器(数组, 或者set, list) 如何遍历(堆不空?), 遍历到内部的点时判断是否符合题意(边界, 走过), 再考虑题意, 判断当前的点是否 ...
分类:其他好文   时间:2017-07-23 22:55:37    阅读次数:174
[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 adjacen ...
分类:其他好文   时间:2017-07-12 00:57:36    阅读次数:214
Surrounded Regions
130. Surrounded Regions 题目链接:https://leetcode.com/problems/surrounded-regions/#/description 题目大意:给定一个二维的板,板上是'X'或'O'字符,捕获所有被'X'包围的区域,在该区域内的字符'O'翻转为'X' ...
分类:其他好文   时间:2017-06-24 19:52:34    阅读次数:155
【LeetCode-面试算法经典-Java实现】【130-Surrounded Regions(围绕区域)】
【130-Surrounded Regions(围绕区域)】 【LeetCode-面试算法经典-Java实现】【全部题目文件夹索引】 原题 Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. ...
分类:编程语言   时间:2017-06-10 14:06:59    阅读次数:352
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 adjacen ...
分类:其他好文   时间:2017-06-08 10:33:49    阅读次数:191
[LeetCode] 130. Surrounded Regions
https://leetcode.com/problems/surrounded-regions weight union find 解法: ...
分类:其他好文   时间:2017-05-23 01:19:41    阅读次数:235
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 adj ...
分类:其他好文   时间:2017-05-14 01:00:14    阅读次数:206
[LeetCode]Surrounded Regions
题目:Surrounded Regions 给定一个二维矩阵由'x'和'o'表示,其中o被x包围了,如果o上下左右中有其他的o,则被看做是连在一起的,而一起的o中有一个贴边了,就表示这些o都是活的。死的o要替换成x。 思路: 采用广度优先搜索或深度优先搜索来找到连在一起的o;只要遍历过程中有一个贴边 ...
分类:其他好文   时间:2017-04-28 18:26:58    阅读次数:144
[LeetCode]130 Surrounded Regions(DFS)
题目链接:https://leetcode.com/problems/surrounded-regions/?tab=Description 题意:把非边界的O改成X。 先dfs边界的,打好标记。把没变的变成X后同时更新标记的为O。 ...
分类:其他好文   时间:2017-03-11 00:48:36    阅读次数:174
192条   上一页 1 2 3 4 5 6 ... 20 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!