Zoox interview question

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