Google | L3 Phonescreen
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-08-05Added By Anonymous
Source: Link
Company: Google
Role: L3
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Recently gave phone screen interview for Google. The question I was given was approximately this:
You are given an array representing altitude at various points of a landscape. You are given another array of indexes representing the position of fountains on the landscape. You are to return a bitmask array representing the points which can be flooded. The condition for flooding was: point should be lower or at same height as the nearest fountain.
Example:
altitudes - [1,2,3,2,4,5]
fountains - [1,5]
expected answer - [1,1,0,1,1,1]