LeetCode
Number of Islands
Click
here
for an explanation.