import java.util.*;
public class Main {
public static Boolean sorted(int arr[] , int si , Boolean ans){
// base condition
if(arr[si] >= arr.length-1)
return true ;
if(arr[si] > arr[si+1])
{
ans = false ;
return ans ;
}
if(arr[si] <= arr[si+1])
sorted(arr , si+1 , ans);
return ans ;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt() ;
int arr[] = new int[n];
for(int i = 0 ; i < arr.length ; i++ )
arr[i] = sc.nextInt() ;
Boolean final_ans = sorted(arr , 0 , false);
System.out.println(final_ans);
}
}
WITH THIS CODE I AM GETTING A RUN TIME ERROR FOR CASE 1 COULD U PLEASE HELP ME OUT