Skip to content

Commit b071a7e

Browse files
committed
[LeetCode Sync] Runtime - 3 ms (40.45%), Memory - 18 MB (26.59%)
1 parent 40c99b6 commit b071a7e

File tree

1 file changed

+11
-0
lines changed
  • Solutions/0350-intersection-of-two-arrays-ii

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
3+
count = Counter(nums1)
4+
result = []
5+
6+
for val in nums2:
7+
if count[val]:
8+
result.append(val)
9+
count[val] -= 1
10+
11+
return result

0 commit comments

Comments
 (0)