McDonald's interview question

Solve this code for me