title: Program Check Array Sorted Not Iterative Recursive 1
signature: program_check_array_sorted_not_iterative_recursive_1 <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(6L, 8L, 8L, 16L, 19L, 19L, 21L, 23L, 26L, 33L, 34L, 36L, 38L, 39L, 41L, 41L, 45L, 47L, 52L, 52L, 55L, 57L, 60L, 60L, 60L, 61L, 69L, 69L, 70L, 70L, 72L, 73L, 73L, 75L, 78L, 81L, 84L, 84L, 85L, 88L, 88L, 89L, 90L, 91L, 97L), 22L, 
          TRUE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(2L, -90L, 66L, 24L, -18L, 70L, 34L, 18L, 84L, -62L), 9L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(1L, 1L), 1L, 
          TRUE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(12L, 88L, 65L, 82L, 23L, 39L, 60L, 27L, 57L, 44L, 70L, 28L, 23L, 34L, 25L, 11L, 48L, 65L, 10L, 73L, 26L, 10L, 18L, 60L, 73L, 45L, 26L, 9L, 36L, 15L, 24L, 40L, 2L, 4L, 95L, 20L, 39L, 45L), 23L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-38L, 38L, 40L, 72L), 2L, 
          TRUE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 0L, 1L), 3L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(11L, 15L, 16L, 17L, 17L, 17L, 22L, 23L, 23L, 25L, 27L, 28L, 28L, 31L, 33L, 36L, 38L, 40L, 42L, 44L, 46L, 49L, 51L, 51L, 52L, 60L, 62L, 65L, 67L, 71L, 74L, 77L, 77L, 78L, 78L, 79L, 83L, 83L, 86L, 86L, 87L, 87L, 87L, 88L, 91L, 92L, 97L, 97L, 97L), 44L, 
          TRUE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-26L, -90L, -78L, -76L, -58L, -64L, -72L, -34L, -58L, -48L, 78L, -50L, -30L, 26L, -60L, 26L), 9L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 23L, 
          TRUE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(56L, 51L, 63L, 30L, 10L, 88L, 23L, 1L, 48L, 4L, 28L, 44L), 10L, 
          FALSE
      )))
  
  }
  
  main()
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;
  }