Smoothstack Interview Question

Asked to program something via a prompt.