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

VIEW FULL DISCUSSION
 

An island is surrounded by a group of adjacent cells that are all 1s.

Do you mean it's surrounded by adjacent 0's?

 

This picture should clarify what it means. Each color group represents each island.
island

 

Thanks, that's what I thought it meant, but wasn't sure.

 

a correct way to say it would be "an island is a group of adjacent cells that are all 1s, surrounded by 0s or array's margins"

code of conduct - report abuse