Pregunta de entrevista de Google

Nothing found on leetcode, more specific to google but can use same concepts