#K72697. Integer Occurrence Query
Integer Occurrence Query
Integer Occurrence Query
You are given an array of integers and an integer ( k ). Your task is to determine if there exists an integer in the array that occurs exactly ( k ) times. In other words, let the array be ( A = [a_1, a_2, \dots, a_n] ). You need to check if there exists an integer ( x ) such that the frequency count of ( x ) in ( A ) is exactly ( k ).
The input is provided via standard input and the output should be written to standard output. Output ( True ) if such an integer exists and ( False ) otherwise.
inputFormat
The input is read from standard input in the following format:
( n ): An integer representing the number of elements in the array.
( a_1, a_2, \dots, a_n ): ( n ) space-separated integers representing the array elements.
( k ): An integer representing the target frequency count.
outputFormat
The output is a single line written to standard output. It should be either ( True ) if there exists an integer that occurs exactly ( k ) times in the array, or ( False ) otherwise.## sample
10
1 2 2 3 3 3 4 4 4 4
3
True
</p>