Amelia interview question

Basic problem solving, DSA