Google Onsite Interview US

google logo
google
USOngoing
September 14, 202512 reads

Summary

I participated in an onsite interview at Google in the US, where the main challenge involved a complex graph traversal problem focused on counting lakes within an island grid under specific conditions.

Full Experience

I had an onsite interview at Google in the US. The session started with a unique problem: 'Count the number of lakes in an island.' I was given a large m * n grid and an island coordinate. The task was to determine the number of lakes within that island. A critical detail was that any lake connected to the surrounding ocean should not be counted. The problem statement initially had some ambiguities, and I spent the first 15 minutes asking clarifying questions to fully grasp the requirements, especially regarding how to handle the large grid size and distinguish lakes from the ocean.

Interview Questions (1)

Q1
Count Lakes in an Island Grid
Data Structures & AlgorithmsHard

Given a large grid of m * n and an island coordinate within it, I needed to calculate the number of lakes from that coordinate. The grid could have multiple islands, all surrounded by a large ocean, and I could assume ocean outside the grid boundaries. I clarified that there could be zero or more lakes, and crucially, if a lake within an island was connected to the ocean, it should not be counted. The main constraint highlighted was the grid's immense size, requiring an efficient method to distinguish lakes from the ocean.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!