Amazon Onsite question - SDE 1
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-03-15Added By Anonymous
Source: Link
Company: Amazon
Role: SDE I
Interview Stage: Onsite
Location: unknown
Year: unknown
Original Post Content:
Recently got this in an Amazon onsite interview, I have solved the question using BFS but the interviewer seems to give mixed reaction to my solution. Though he didn't mention if it was wrong or right
Can anyone give me the solution or approach for this, want to check if there are any other methods to solve this
Problem: Given a matrix consisting of 0s and 1s, count the number of islands (Number of Islands - LC 200).
Follow-up: If there is a gap of only one cell between two islands, they should be considered connected.
Constraints : No extra space allowed.