My issue
rewrite code
My code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
int[] a = new int[n];
int max=INT_MIN;
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt();
if(a[i]>max)
max=a[i];
}
System.out.println(max);
}
// Your code goes here
}
}
Learning course: Practice Arrays
Problem Link: Largest and Second Largest Practice Problem in Arrays