Distinct Island
Given a boolean 2D matrix. The task is to find the number of distinct islands where a group of connected 1s (horizontally or vertically) forms an island. Two islands are considered to be distinct if and only if one island is identical to another (not rotated or reflected).
CodingNinjas
author
2y
- Firstly I told the interviewer, the Depth-first search approach. I ran Depth-first search on each element of the matrix which is un-visited while traversing the matrix and for each island, I assigned ...read more
CodingNinjas
author
2y
Depth First Search
- For every 1 in the matrix, do DFS and mark all the 1’s as visited which are connected to this 1 and store the path of the island in a string.
Followings are the abbreviated path :
‘...read more
Help your peers!
Add answer anonymously...
Top Barclays Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Barclays Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app