Read it. Write it. Check it.
Work through 6 original coding questions in 2 groups. Your drafts and solved status stay in this browser.
Loading practice progress.
0 of 6 solvedLoading device progress
easynew
Keep unique values
Return the values that appear in the input, keeping only their first appearance. Preserve the original order.
Examples
- Input
- [[4,2,4,1,2]]
- Expected
- [4,2,1]
- Input
- [[3,1,8]]
- Expected
- [3,1,8]
Constraints
- The input contains at most 10,000 finite numbers.
- Do not sort the input.
- Return a new array.
unique-values.tsSolution.uniqueValues() · browser sandboxCode editor. Tab accepts an open suggestion; otherwise it indents. Press Escape, then Tab, to leave the editor. Press Command or Control plus Enter to check your solution.
Run the examples for a quick pass, or check the full solution to record progress.