re: Amazon's Interview Question: Count Island VIEW POST

FULL DISCUSSION
 

Umm, call me dumb, but according to the definition you have provided, there is only one island - centered at the second row fourth column.
The solution rather says an island is an isolated one, or a group of adjacent ones, diagonals excluded; that would give six as a result indeed.

code of conduct - report abuse