Skip to content

Commit 1aa28bf

Browse files
authored
Create 0349-intersection-of-two-arrays.py
1 parent 08dfd1d commit 1aa28bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)