Number of Islands | Java | LeetCode Solution 200

preview_player
Показать описание
This problem is considered to be Medium difficulty on LeetCode and has been asked by Amazon, Facebook, Microsoft, and Google. We will be using Java in our solution.

#coding #leetcode #interviews
Рекомендации по теме
Комментарии
Автор

By far the most clear explanation I've seen thank you!!

mockmock-wvgi
Автор

Nice explanation buddy, you have explained very well 👍👍👍

umarfarooqshaik
Автор

excellent explaination, you deserve more followers, I have my google interview 2 days later, wish me luck fam <3

CodeCreated
Автор

Hey thanks for the solution, but is the worst case really n^2? Seems more like it would be n^4. Imagine a large grid of all 1s. You'll immediately enter the first tile and do a dfs across all tiles (n^2). But then when you exit the function you're still needing to loop across every time even though you've already covered it.

Am I missing something here?

KENTOSI
Автор

after few similar 2D traversing case, I've finally have a better understanding of the dfs algorithm and this video helped a lot. thanks

dhanniekristanto
join shbcf.ru