#Leetcode #200. Number of #Islands || Code + Explanation

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

exceptional explanation. Found it very useful. Thank you

samrat
Автор

Most underrated channel i must say
Keep growing!!!

sanskarkapoor
Автор

Easy to learn and straightforward to apply. Thankyou!

vishalchaurasia
Автор

Ty for the solution, very nicely explained.

viisharma
Автор

Great, explanation! Loved it. <3 <3

arifrubayet
Автор

after wasting a lot of time & then watching your video two times every thing gets clear thank u mam

DHIRAJKUMAR-iwdj
Автор

Alisha I am your fan now
The way you explain such problems and how can i forget the pecific and Atlantic ocean problem the explanation was mind blowing I just loved the explanation the way you explain the iterations really appreciated
And the best part is that I get the explanation for most of the problem i stuck with here on this channel 🤗💪

manjitKK
Автор

Leetcode m iska example hi clear Nhi horha tha ki yé Bolna kya chate hain😂....after watching thé example Here i have implemented thé code on myself. 😁

rachitbadoni
Автор

Your solution is having Time complexity O(n^2) , How we can optimised it ??

manan.jain
Автор

How to calculate the time complexity of this one?

chandrasekharreddymuthumul
Автор

its showing runtime error ..can u please tell why?

bellanatrisha
visit shbcf.ru