Sr Android Developer Interview Questions

1,907 sr android developer interview questions shared by candidates

[Coding] Islands count. Given a 5x5 matrix where 1 represents a land and 0 represent a water. Write a function that will count the islands in the given matrix. What's an island? If 1 has an adjacent 1 in any direction (N, NE, E, SE, S, SW, W, NW) it forms an island. -- [code javascript] --- var m = [ [1, 1, 0, 0, 0], [0, 1, 0, 0, 1], [1, 0, 0, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1] ]; function islandsCount(map) { // your code here return 0; } console.log("Number of islands: ", islandsCount(m)); -- [end code javascript] --- Expected count is 5.
avatar

Senior Android Developer

Interviewed at Ritual

4
Feb 13, 2019

[Coding] Islands count. Given a 5x5 matrix where 1 represents a land and 0 represent a water. Write a function that will count the islands in the given matrix. What's an island? If 1 has an adjacent 1 in any direction (N, NE, E, SE, S, SW, W, NW) it forms an island. -- [code javascript] --- var m = [ [1, 1, 0, 0, 0], [0, 1, 0, 0, 1], [1, 0, 0, 1, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1] ]; function islandsCount(map) { // your code here return 0; } console.log("Number of islands: ", islandsCount(m)); -- [end code javascript] --- Expected count is 5.

Viewing 1361 - 1370 interview questions

Glassdoor has 1,907 interview questions and reports from Sr android developer interviews. Prepare for your interview. Get hired. Love your job.