Snap interview question

Can you solve this coding problem?