We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 08dfd1d commit 1aa28bfCopy full SHA for 1aa28bf
python/0349-intersection-of-two-arrays.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
3
+ seen = set(nums1)
4
+
5
+ res = []
6
+ for n in nums2:
7
+ if n in seen:
8
+ res.append(n)
9
+ seen.remove(n)
10
+ return res
0 commit comments