pMD interview question

Hand write code with pencil and paper.