#K78362. Longest Combo Length
Longest Combo Length
Longest Combo Length
You are given a sequence of button presses represented as integers. Your task is to determine the length of the longest contiguous combo in the sequence. A combo is defined as a subarray where every element is at least as large as the previous one. In other words, a combo is a contiguous segment \(b_l, b_{l+1}, \dots, b_r\) such that for every \(i\) with \(l < i \le r\), \(b_i \ge b_{i-1}\). If the sequence contains only one element, then the combo length is 1.
Input Format: The input starts with an integer \(T\) indicating the number of test cases. For each test case, the first line contains an integer \(n\) representing the number of button presses, and the next line contains \(n\) integers representing the sequence of button presses.
Output Format: For each test case, output the length of the longest combo in a new line.
Example:
Input: 3 8 1 2 2 3 1 2 3 4 5 3 3 3 3 3 6 1 2 1 2 1 2</p>Output: 4 5 2
inputFormat
The first line contains an integer \(T\), the number of test cases. Each test case consists of two lines:
- The first line contains an integer \(n\), the length of the sequence.
- The second line contains \(n\) space-separated integers representing the sequence of button presses.
outputFormat
For each test case, output a single integer on a new line, representing the length of the longest combo (i.e. longest contiguous subarray where every element is not less than its previous element).
## sample3
8
1 2 2 3 1 2 3 4
5
3 3 3 3 3
6
1 2 1 2 1 2
4
5
2
</p>