Niveus Solutions interview question

Two Puzzles and coding in both technical rounds