#C8535. Unique Array Elements
Unique Array Elements
Unique Array Elements
Given an array of integers, you are to output the list of unique elements in the order of their first occurrence. This problem requires you to remove duplicates while maintaining the original order in which the numbers first appear.
Formally, given an integer \( n \) and an array \( A = [a_1, a_2, \dots, a_n] \), you need to construct a new array \( B \) such that each element in \( B \) appears only once and in the same order as they first appear in \( A \). For example, if \( A = [4, 5, 6, 5, 4] \), then \( B = [4, 5, 6] \>.
inputFormat
The input consists of two lines:
- The first line contains an integer \( n \) representing the number of elements in the array.
- The second line contains \( n \) space-separated integers.
outputFormat
Output the unique elements in one line separated by a single space, in the order of their first occurrence.
## sample5
4 5 6 5 4
4 5 6
</p>