Crossover for Work interview question

Simple algorithmic tasks.