#C10455. Find Repeating Elements
Find Repeating Elements
Find Repeating Elements
You are given an array of n integers. Your task is to find all the elements in the array that appear more than once and then output these elements in ascending order.
For example, given an array arr
, you need to compute:
$$\{x \mid x \in arr \text{ and the frequency of } x > 1\}$$
If no element repeats, output an empty line.
Examples:
- Input:
8\n4 3 2 7 8 2 3 1
→ Output:2 3
- Input:
5\n1 2 3 4 5
→ Output:(empty output)
inputFormat
The first line contains an integer n, representing the number of elements in the array. The second line contains n space-separated integers which form the array.
outputFormat
Output the repeating elements in ascending order, separated by spaces. If there are no repeating elements, output an empty line.
## sample8
4 3 2 7 8 2 3 1
2 3