Company: ibm_7aug
Difficulty: medium
Common Ages Problem Description Given two arrays containing ages of volcanic and non-volcanic materials, identify all ages that appear in both arrays. Return these common ages sorted in descending order (oldest to newest). For example, you are given the following two arrays: volcanic = [7000, 13400, 7000, 14000] nonVolcanic = [7000, 13400, 150000, 7000] Your return array should show: result = [13400, 7000, 7000] The age 7000 is present twice in both input arrays. Therefore, there are two matches and both should be returned in the output array. Likewise, 13400 is present in both arrays and should be returned in the output array. However, there is no matching number for 150000 in volcanic or 14000 in nonVolcanic, so these two numbers should not be returned in result. Function Description Complete the function commonAges in the editor with the following parameter(s): int volcanic[n] : an array of integers int nonVolcanic[m] : an array of integers Returns int[] : the ages of matching pairs