DIY: Intersection of Two Arrays

Solve the interview question "Intersection of Two Arrays" in this lesson.

Problem statement

Given two integer arrays, nums1 and nums2, you will return an array of their intersection. Each element in the result must be unique, and you may return the result in any order.

Constraints:

  • 1 <= len(nums1), len(nums2) <= 1000
  • 0 <= nums1[i], nums2[i] <= 1000

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.