Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

200. Number of Islands #18

Open
F4NT0 opened this issue Apr 20, 2024 · 0 comments
Open

200. Number of Islands #18

F4NT0 opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
Medium Medium Questions Ready to code Description from the Question was updated with code and text

Comments

@F4NT0
Copy link
Owner

F4NT0 commented Apr 20, 2024

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.

Example 1:

  • Input: grid =

[
["1","1","1","1","0"],
["1","1","0","1","0"],
["1","1","0","0","0"],
["0","0","0","0","0"]
]

  • Output: 1

Example 2:

  • Input: grid =

[
["1","1","0","0","0"],
["1","1","0","0","0"],
["0","0","1","0","0"],
["0","0","0","1","1"]
]

  • Output: 3

Constraints:

  • m == grid.length
  • n == grid[i].length
  • 1 <= m, n <= 300
  • grid[i][j] is '0' or '1'.
@F4NT0 F4NT0 added the Medium Medium Questions label Apr 20, 2024
@F4NT0 F4NT0 added this to the April Leetcode milestone Apr 20, 2024
@F4NT0 F4NT0 self-assigned this Apr 20, 2024
@F4NT0 F4NT0 added the Ready to code Description from the Question was updated with code and text label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Medium Questions Ready to code Description from the Question was updated with code and text
Projects
None yet
Development

No branches or pull requests

1 participant