I'd recommend using a set (or hashset) to keep track of the visited locations (i, j) because setting grid[i][j] from 1 to 0 (from land to water) introduces a side effect, meaning that the same 'grid' variable will not be reusable after the call without making a deep copy of it first.
Hi Michael, thank you so much for the explanation. I really like to watch your video. Please keep doing them. Can you please also do a video about leetcode 547 friend circles? It seems very similar to this question but not the same and I got very confused.
I'd recommend using a set (or hashset) to keep track of the visited locations (i, j) because setting grid[i][j] from 1 to 0 (from land to water) introduces a side effect, meaning that the same 'grid' variable will not be reusable after the call without making a deep copy of it first.
this guy is better than most youtubers in explanation.👌
You explain the problems so well bro. Keep it up!
Thank you so much 😀
Thank you so much. Your explanations are so good! Now I can solve such questions with ease.
Glad it helped!
Very simple explanation. Thanks a ton !!!
Most welcome!
Hi Michael, thank you so much for the explanation. I really like to watch your video. Please keep doing them. Can you please also do a video about leetcode 547 friend circles? It seems very similar to this question but not the same and I got very confused.
Thank you, will do!
@@AlgosWithMichael Thank you so much Michael!! Millions of thanks!! I am watching your other videos.
Great Content!
Thank you!
is "grid" parameter in "getArea( )" counted is the space complexity ???
No because grid is being passed by reference.
Nice Explaination :")
Thank you!