#C3233. Find the Largest Element in Each Subarray
Find the Largest Element in Each Subarray
Find the Largest Element in Each Subarray
You are given multiple test cases. In each test case, the first number represents the size \(N\) of the array, followed by \(N\) integers. Your task is to find the maximum (largest) element in each array.
Input Format: The first line of input contains a single integer \(T\), the number of test cases. Each of the following \(T\) lines begins with an integer \(N\) (the size of the array), followed by \(N\) integers separated by spaces.
Output Format: For each test case, output a single line containing the largest element in the corresponding array.
Note: It is guaranteed that the number of integers following \(N\) exactly matches \(N\).
inputFormat
The input begins with an integer \(T\) on a new line denoting the number of test cases. For each test case, there is a line that starts with an integer \(N\) followed by \(N\) space-separated integers.
Example:
3 5 1 3 -2 8 5 3 -1 -5 -3 4 7 4 2 9
outputFormat
For each test case, print the largest integer in the array on a new line.
Example Output:
8 -1 9## sample
3
5 1 3 -2 8 5
3 -1 -5 -3
4 7 4 2 9
8
-1
9
</p>