The TransCompilator

Solved LeetCode program · 80 of 1,000

#0080 · Remove Duplicates from Sorted Array II

Medium Array chunk-02.md

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.

Open in Playground Browse all 1,000 problems

Expected stdout

5
1
1
2
2
3