Thomson Reuters Interview Question

the only code pair question was one of the puzzles from Hacker Rank.