Intersection of Two Arrays II

Given two integer arrays, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays.

Constraints

  • 1 <= nums1.length, nums2.length <= 1000
  • 0 <= nums1[i], nums2[i] <= 1000
Saving… · 2 lines
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
Console

Click Run to execute sample tests.