LinkedIn | Phone Screen | Union of two sorted arrays
Anonymous User
8872
/**
*  @param a - a list of non null integers, in ascending order
*  @param b - a list of non null integers, in ascending order
*  @return the integers that are contained in either a or b, in ascending order
*/

List<Integer> union(List<Integer> a, List<Integer> b);

Follow up: Given access to multicore processor, how would you implment the same function so that we can do an union faster (in terms of time complexity)
Hint: split the inputs to perform union and merge them back in O(1) time.

Comments (16)