Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result should appear as many times as it shows in both arrays. You may return the result in any order.
For example, if nums1 has two 2s and nums2 has three 2s, the result should contain two 2s (the minimum count).
nums1 = [1, 2, 2, 1], nums2 = [2, 2][2, 2]nums1 = [4, 9, 5], nums2 = [9, 4, 9, 8, 4][4, 9]nums1 = [1, 2, 3], nums2 = [4, 5, 6][]0 <= nums1.length, nums2.length <= 10^4-10^5 <= nums1[i], nums2[i] <= 10^5Run your code to see results
Use Cmd+Enter to run