give integer array nums1 nums2 return array intersection each element result appear time show array return result order Example 1input nums1 1221 nums2 22output 22example 2input nums1 495 nums2 94984output 49explanation 94 accept Constraints1 nums1length nums2length 10000 nums1i nums2i 1000 Follow upwhat give array sort how optimize algorithmwhat nums1s size small compare nums2s size which algorithm betterwhat element nums2 store disk memory limit load element memory