Intel Corporation interview question

Given 2 set arrays create a sorted array from both

Interview Answer

Anonymous

12 Aug 2021

Define a new array the size of the sum of the two sizes of the arrays. Set up two pointers at the beginning of each given array. Comparing the two pointers, the smaller number of the two we will put into the new array. The pointer that pointed to the smaller number should advance to the next numberr in its array. you do this untill you reach the end of one of the arrays.