Anonymous interview question

just some basic coding question