My issue
I think the code is fine. how do I fix the runtime error at submission?
My code
#include <stdio.h>
int main(void) {
// your code goes here
int t, n, height[n];
scanf("%d",&t); //test cases input
scanf("%d",&n); //input n i.e no of mountains
//input the heights of the mountain
for(int i=0; i<n; i++){
scanf("%d", &height[i]);
}
int tallest=height[0]; //assume the first mountain is the highest
for(int i=0; i<n; i++){
if(height[i]>tallest){
tallest=height[i];
}
}
printf("%d",tallest); //print the height of the tallest montain found
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-dsa-c/MUJDSAC06/problems/UWCOI20A