Solved LeetCode program · 80 of 1,000
#0080 · Remove Duplicates from Sorted Array II
Original English source
The nums is a list of 1, 1, 1, 2, 2, and 3. The result is an empty list of whole numbers.
For each number in nums.
The occurrences is 0. For every existing in result, if existing is number, add 1 to occurrences. If occurrences is less than 2, Place number into result.
Report the number of items in result. For each number in result, report number.
Expected stdout
5 1 1 2 2 3