MZ interview question

Fiz Bang coding question