본문 바로가기

뇌세포덩어리""/알고리즘

[leetcode] dfs/bfs 섬 문제들

https://leetcode.com/problems/flood-fill/

 

 

https://leetcode.com/problems/number-of-islands/

 

Number of Islands - LeetCode

Number of Islands - Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may ass

leetcode.com

 

https://leetcode.com/problems/island-perimeter/

 

Island Perimeter - LeetCode

Island Perimeter - You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and

leetcode.com

 

https://leetcode.com/problems/max-area-of-island/

 

Max Area of Island - LeetCode

Max Area of Island - You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. The area of an island is

leetcode.com

https://leetcode.com/problems/count-sub-islands/

 

Count Sub Islands - LeetCode

Count Sub Islands - You are given two m x n binary matrices grid1 and grid2 containing only 0's (representing water) and 1's (representing land). An island is a group of 1's connected 4-directionally (horizontal or vertical). Any cells outside of the grid

leetcode.com

 

 

https://leetcode.com/problems/number-of-closed-islands/description/

 

Number of Closed Islands - LeetCode

Number of Closed Islands - Given a 2D grid consists of 0s (land) and 1s (water).  An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s. Return the number

leetcode.com