Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Intersection of Two Arrays II
Bookmark
Input
Standard
Multiple Matches
No Intersection
Custom
nums1
=
[1, 2, 2, 1]
,
nums2
=
[2, 2]
nums1
nums2
1
1
2
2
2
2
result
(empty)
two sorted arrays, walk them together to collect shared values
algo
master
.
io
Step:
Find shared values (with repeats) between the two arrays
0 / 16
Input
Standard
Multiple Matches
No Intersection
Custom
nums1
=
[1, 2, 2, 1]
,
nums2
=
[2, 2]
0 / 16
nums1
nums2
1
1
2
2
2
2
result
(empty)
two sorted arrays, walk them together to collect shared values
algo
master
.
io
Step:
Find shared values (with repeats) between the two arrays