You can merge k-way on arrays and check the first element that appears k times.
An alternative is to create a histogram and select the first element that displays the time k on the histogram. A histogram in java can be easily implemented using Map<Element,Integer>
Both solutions: O(kn) , where k is the number of arrays and n is the average size of the array, so it is mostly linear in input size.
source share