Leetcode 0200. Number of Islands

Posted on Tue 26 November 2024 in Leetcode • Tagged with dfs-bfs-grid

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

Difficulty: Medium

Premium: False

Question

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 …


Continue reading

Leetcode 0695. Max Area of Island

Posted on Tue 26 November 2024 in Leetcode • Tagged with dfs-bfs-grid

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

Difficulty: Medium

Premium: False

Question

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 …


Continue reading

Leetcode 1020. Number of Enclaves

Posted on Thu 06 April 2023 in Leetcode • Tagged with dfs-bfs-grid

Question Link : https://leetcode.com/problems/number-of-enclaves/

Difficulty: Medium

Premium: False

Question

You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists of walking from one land cell to another adjacent (4-directionally) land cell or …


Continue reading

Leetcode 1254. Number of Closed Islands

Posted on Wed 05 April 2023 in Leetcode • Tagged with dfs-bfs-grid

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

Difficulty: Medium

Premium: False

Question

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 …


Continue reading