#K85487. Majority Element
Majority Element
Majority Element
You are given an array of integers where a majority element always exists. The majority element is the element that appears more than (\lfloor n/2 \rfloor) times, where (n) is the number of elements in the array. Your task is to determine this majority element.
Example: For the array [3, 2, 3], the output is 3 since 3 occurs more than (\lfloor 3/2 \rfloor = 1) times.
inputFormat
The input is given from standard input (stdin) and consists of two lines:
- The first line contains a single integer (n) denoting the number of elements in the array.
- The second line contains (n) space-separated integers representing the elements of the array.
outputFormat
Output a single integer, which is the majority element of the array, to standard output (stdout).## sample
3
3 2 3
3
</p>