I am getting runtime error while compliling the code
// your code goes here
Scanner sc =new Scanner(System.in);
int c=sc.nextInt();
int d=0;
for(int i=0;i<c;i++)
{
int l=sc.nextInt();
intarr=new int[10];
for(int j=0;j<l;j++)
{
arr[j]=sc.nextInt();
}
boolean isNonDecreasing = true;
for(int k=1;k<l;k++)
{
if(arr[k] < arr[k-1])
{
isNonDecreasing = false;
break;
}
}
if(isNonDecreasing)
{
System.out.println("yes");
}
else
{
System.out.println("no");
}
}
}
}
bro can u send the problem link??
click on the practical coding for everyone you will be redirected to problem
@tejakonne
the size of the array is 100 at max but u have used 10 only .
and also plzz check the syntax to take input for the array in java , cozz i’m not familiar with it.
rest your logic is absolutely correct .