Waymo interview question

Regular coding problem