Surrounded Regions (130)
摘要:1. BFS 时间 O(n*m) 空间 O(1) 1. 把所有的O标记为‘1’ 2. 从四周向内看把标记为‘1’的变回'O' -> 时间O(n+m) 3. 把没有在2步骤中变化的‘1’变‘X’->时间O(n*m) ->时间O(n*m + n +m) 此方法比Union find要快 2. union
阅读全文
posted @ 2018-09-06 13:05
posted @ 2018-09-06 13:05
posted @ 2018-09-06 11:37
posted @ 2018-08-31 13:04
posted @ 2018-08-31 11:46
posted @ 2018-08-27 14:00
posted @ 2018-08-27 10:10