#C7533. Counting the Tallest Candles
Counting the Tallest Candles
Counting the Tallest Candles
You are given a list of candles with their heights. Your task is to determine how many of the candles are the tallest. Formally, for an array of candle heights \(a_1, a_2, \ldots, a_n\), you are to compute the number of occurrences of \(\max_{1 \leq i \leq n}\{a_i\}\). This is a typical problem of iterating through a list and counting occurrences.
Input/Output Format: The input begins with an integer \(T\) representing the number of test cases. For each test case, the first line contains an integer \(n\) denoting the number of candles, followed by a line of \(n\) space-separated integers representing the heights of the candles. For each test case, output a single line that contains the count of the tallest candles.
inputFormat
The first line contains a single integer \(T\), the number of test cases. For each test case, the first line contains an integer \(n\) (the number of candles). The next line contains \(n\) space-separated integers, representing the height of each candle.
Example:
1 4 3 2 1 3
outputFormat
For each test case, print a single integer indicating the number of candles that have the maximum height. Each result should be printed on a new line.
Example:
2## sample
1
4
3 2 1 3
2
</p>