Eightfold Interview Question

question was based on merging two arrays