All Problems
mediumLists

Remove Duplicates from List

Problem Statement
Remove duplicate elements from a list while preserving order.

SAMPLE INPUT

8
1 2 3 2 4 3 5 1

SAMPLE OUTPUT

1 2 3 4 5

CONSTRAINTS

  • 1 <= n <= 1000

Explanation: Use a set to track seen elements and preserve insertion order.

Code Editor
Output
Click "Run" to see output...