WD interview question

C Program to solve a puzzle.