Frage im Vorstellungsgespräch bei Amazon

https://leetcode.com/problems/number-of-islands/ leet code question number 200