The following code is from a coding exercise requested of me for an interview