filmov
tv
#40 Number of Islands Problem | Leetcode - Java | Grind 75: Coding Series

Показать описание
This is another video in the Grind 75: A better Blind 75 Coding Series.
Problem 40/75: Number of Islands
Platform: Leetcode
Language: Java
Time Complexity: O(m * n), where m is the number of rows and n is the number of columns in the grid. Each cell is visited once during the DFS traversal.
Problem Statement:
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 assume all four edges of the grid are all surrounded by water.
Solution:
Problem 40/75: Number of Islands
Platform: Leetcode
Language: Java
Time Complexity: O(m * n), where m is the number of rows and n is the number of columns in the grid. Each cell is visited once during the DFS traversal.
Problem Statement:
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 assume all four edges of the grid are all surrounded by water.
Solution: