Workday interview question

Basic algorithms question