Pregunta de entrevista de Zoox

Array processing algorithm question, with followup to make it more challenging.