import java.util.*;
public class Main {
public static Boolean sorted_arr(int arr[] , int si){
if(si == arr.length -1)
return true ;
if(arr[si] > arr[si+1])
return false ;
Boolean ans = sorted_arr(arr , si+1);
return ans;
}
public static void main(String args[]) {
int arr[] = {-1 , -2 , -4, -5};
System.out.println(sorted_arr(arr , 0));
}
}
As far as i have checked this code for neg values it is workign could u please correct my code if am missing something