I had my Google phone screen yesterday for L4 the question I got asked was there is a grid, we have which has water, land. Given a coordinate of land ,find number of lakes of that island. I told him first we wlill traverse from edges and mark ocean nodes as ocean. Next we wlill traverse the given island coordinate, when we encounter unvisited water we will start dfs of water and increase no of lakes .He was okay with my approach, started coding, after I had written ocean traversal and start land bfs , he stopped me and was trying to steer me towards some approach he had in mind, he said don't do bfs for island ,l asked then how do I find the unvisited water. He said one land is connected to another land we will check like that, I asked him that is same as traversal he didn't answer, and was asking me to find boundary of island. I said we can do dfs or bfs and nodes which are adjacent are sea are boundary nodes. And then was asking find lakes from boundary. Itold Iwould find max left , top, right, bottom node of island and traverse that rectangle and find number of lakes, and he was saying my initial approach was complicated, but finding boundary and doing this is more complicating things, the time was finished I told him TC and SC, I asked him about his time at Google, he said he was at Google for 1.5 years. I checked his linkedin, he was only there for 9 months
He clearly doesn't know how to take an interview. What do you think are my chances?
Comments (5)


