#K56537. Counting Significant Peaks
Counting Significant Peaks
Counting Significant Peaks
Given several test cases, each test case consists of a sequence of integers. An element at index (i) (where (1 \leq i \leq n-2)) is defined as a significant peak if it satisfies the condition $$ A_i > A_{i-1} \quad \text{and} \quad A_i > A_{i+1} $$. Your task is to count the number of significant peaks in each sequence and output the result for each test case on a new line.
inputFormat
The input is given via standard input (stdin). The first line contains a single integer (T) representing the number of test cases. Each test case starts with an integer (n) denoting the length of the sequence, followed by a line containing (n) space-separated integers.
outputFormat
For each test case, output a single line containing one integer — the number of significant peaks in the corresponding sequence.## sample
3
6
1 3 2 4 3 5
5
1 2 3 2 1
4
7 4 5 3
2
1
1
</p>