My issue
“Time Limit Exceeded”
why this comes when I run or submit
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int[] mountain = new int[n];
int highest = 0;
for(int i = 0;i < n;i++){
mountain[i] = sc.nextInt();
if(highest < mountain[i])
highest = mountain[i];
}
System.out.println(highest);
}
}
}
Learning course: Data Structures & Algorithms using C
Problem Link: Find maximum in an Array in Data Structures & Algorithms using C