WD interview question

puzzles and coding, scenario based