1c Company interview question

Was asked to do the assignment.