Company: ibm_7aug
Difficulty: medium
Common Ages Problem Description A geology lab has dated two collections of rock samples. The array volcanic holds the ages of the volcanic samples and the array nonVolcanic holds the ages of the non-volcanic samples. A matching pair is one volcanic sample and one non-volcanic sample that have exactly the same age. Each sample can be used in at most one pair. So if an age occurs x times in volcanic and y times in nonVolcanic , exactly min(x, y) pairs can be formed with that age. Complete the function sortIntersect , which returns the age of every matching pair (one entry per pair) sorted in descending order (oldest first). Input Format Read from standard input. n volcanic[1] volcanic[2] ... volcanic[n] m nonVolcanic[1] nonVolcanic[2] ... nonVolcanic[m] Line 1 contains the integer n , the size of volcanic . Each of the next n lines contains one age volcanic[i] . The next line contains the integer m , the size of nonVolcanic . Each of the next m lines contains one age nonVolcanic[j] . Out