Smoothstack interview question

Asked to program something via a prompt.