title: Program Check Array Sorted Not Iterative Recursive 1
signature: class Solution {
  
      public Boolean programCheckArraySortedNotIterativeRecursive1(ArrayList<Integer> arr, Integer n) {
source_py: def program_check_array_sorted_not_iterative_recursive_1(arr, n):
      if ((n == 0) or (n == 1)):
          return True
      for i in range(1, n):
          if (arr[(i - 1)] > arr[i]):
              return False
      return True
source_cpp: bool program_check_array_sorted_not_iterative_recursive_1(vector<int> arr, int n) {
    if ( n == 0 || n == 1 ) return true;
    for ( int i = 1;
    i < n;
    i ++ ) if ( arr [ i - 1 ] > arr [ i ] ) return false;
    return true;
  }
question_info.extension: java
question_info.entry_fn_name: programCheckArraySortedNotIterativeRecursive1
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"arr": [6, 8, 8, 16, 19, 19, 21, 23, 26, 33, 34, 36, 38, 39, 41, 41, 45, 47, 52, 52, 55, 57, 60, 60, 60, 61, 69, 69, 70, 70, 72, 73, 73, 75, 78, 81, 84, 84, 85, 88, 88, 89, 90, 91, 97], "n": 22}}, {"idx": 1, "outputs": false, "inputs": {"arr": [2, -90, 66, 24, -18, 70, 34, 18, 84, -62], "n": 9}}, {"idx": 2, "outputs": true, "inputs": {"arr": [1, 1], "n": 1}}, {"idx": 3, "outputs": false, "inputs": {"arr": [12, 88, 65, 82, 23, 39, 60, 27, 57, 44, 70, 28, 23, 34, 25, 11, 48, 65, 10, 73, 26, 10, 18, 60, 73, 45, 26, 9, 36, 15, 24, 40, 2, 4, 95, 20, 39, 45], "n": 23}}, {"idx": 4, "outputs": true, "inputs": {"arr": [-38, 38, 40, 72], "n": 2}}, {"idx": 5, "outputs": false, "inputs": {"arr": [1, 0, 0, 0, 1], "n": 3}}, {"idx": 6, "outputs": true, "inputs": {"arr": [11, 15, 16, 17, 17, 17, 22, 23, 23, 25, 27, 28, 28, 31, 33, 36, 38, 40, 42, 44, 46, 49, 51, 51, 52, 60, 62, 65, 67, 71, 74, 77, 77, 78, 78, 79, 83, 83, 86, 86, 87, 87, 87, 88, 91, 92, 97, 97, 97], "n": 44}}, {"idx": 7, "outputs": false, "inputs": {"arr": [-26, -90, -78, -76, -58, -64, -72, -34, -58, -48, 78, -50, -30, 26, -60, 26], "n": 9}}, {"idx": 8, "outputs": true, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 23}}, {"idx": 9, "outputs": false, "inputs": {"arr": [56, 51, 63, 30, 10, 88, 23, 1, 48, 4, 28, 44], "n": 10}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> arr, Integer n, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(arr, n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(6, 8, 8, 16, 19, 19, 21, 23, 26, 33, 34, 36, 38, 39, 41, 41, 45, 47, 52, 52, 55, 57, 60, 60, 60, 61, 69, 69, 70, 70, 72, 73, 73, 75, 78, 81, 84, 84, 85, 88, 88, 89, 90, 91, 97)), 22, true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, -90, 66, 24, -18, 70, 34, 18, 84, -62)), 9, false);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 1)), 1, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(12, 88, 65, 82, 23, 39, 60, 27, 57, 44, 70, 28, 23, 34, 25, 11, 48, 65, 10, 73, 26, 10, 18, 60, 73, 45, 26, 9, 36, 15, 24, 40, 2, 4, 95, 20, 39, 45)), 23, false);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-38, 38, 40, 72)), 2, true);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 0, 0, 0, 1)), 3, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(11, 15, 16, 17, 17, 17, 22, 23, 23, 25, 27, 28, 28, 31, 33, 36, 38, 40, 42, 44, 46, 49, 51, 51, 52, 60, 62, 65, 67, 71, 74, 77, 77, 78, 78, 79, 83, 83, 86, 86, 87, 87, 87, 88, 91, 92, 97, 97, 97)), 44, true);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-26, -90, -78, -76, -58, -64, -72, -34, -58, -48, 78, -50, -30, 26, -60, 26)), 9, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 23, true);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(56, 51, 63, 30, 10, 88, 23, 1, 48, 4, 28, 44)), 10, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> arr, Integer n, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(arr, n),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__