Google | L3 Phonescreen

Anonymous User
923
Aug 05, 2025
Aug 05, 2025

Recently gave phonescreen 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]

Comments (2)