Pregunta de entrevista de Lyft

A coding question from leetcode from the medium or hard category