Count islands in a binary grid | Samsung Interview Question