#K40267. Mode Frequency
Mode Frequency
Mode Frequency
You are given an array A of N integers. Your task is to determine the frequency of the mode of the array, i.e. the maximum number of times any element appears in the array.
If the array is empty (N = 0), output 0
.
Formally, given an array \(A = [a_1, a_2, \ldots, a_N]\), find \(\max_{x} \#\{i : a_i = x\}\), where \(\#\{i : a_i = x\}\) denotes the number of occurrences of x in the array.
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains an integer \(N\) — the number of elements in the array.
- The second line contains \(N\) space-separated integers representing the elements of the array \(A\).
outputFormat
Print a single integer to stdout representing the frequency of the mode (i.e. the count of the most frequently occurring element). If the array is empty (\(N=0\)), print 0
.
6
1 2 2 3 3 3
3
</p>