Pergunta de entrevista da empresa Workday

Basic algorithms question