in reply to to pick the common element in the array
Actually, there's no method to do this, because the problem isn't well defined. You're asking for the common element, but there are at least two common elements, three if you consider the two 2's in each array to be distinct.