Solved LeetCode program · 261 of 1,000
#0350 · Intersection of Two Arrays II
Original English source
The first is a list of 1, 2, 2, and 1. The second is a list of 2 and 2. The used is a list of 0 and 0. The answers is an empty list of whole numbers.
For each value in first.
The found is 0.
For every spot from 0 to 1.
If found is 0 and item spot of used is 0 and item spot of second is value, set item spot of used to 1, set found to 1, Place value into answers.
For each value in answers, show value.
Expected stdout
2 2