title: Convert Strictly Increasing Array Minimum Changes
signature: class Solution {
  
      public Integer convertStrictlyIncreasingArrayMinimumChanges(ArrayList<Integer> arr, Integer n) {
source_py: def convert_strictly_increasing_array_minimum_changes(arr, n):
      LIS = [0 for i in range(n)]
      len = 0
      for i in range(n):
          LIS[i] = 1
      for i in range(1, n):
          for j in range(i):
              if ((arr[i] > arr[j]) and ((i - j) <= (arr[i] - arr[j]))):
                  LIS[i] = max(LIS[i], (LIS[j] + 1))
          len = max(len, LIS[i])
      return (n - len)
source_cpp: int convert_strictly_increasing_array_minimum_changes(vector<int> arr, int n) {
    int LIS [ n ], len = 0;
    for ( int i = 0;
    i < n;
    i ++ ) LIS [ i ] = 1;
    for ( int i = 1;
    i < n;
    i ++ ) {
      for ( int j = 0;
      j < i;
      j ++ ) {
        if ( arr [ i ] > arr [ j ] && ( i - j ) <= ( arr [ i ] - arr [ j ] ) ) {
          LIS [ i ] = max ( LIS [ i ], LIS [ j ] + 1 );
        }
      }
      len = max ( len, LIS [ i ] );
    }
    return n - len;
  }
question_info.extension: java
question_info.entry_fn_name: convertStrictlyIncreasingArrayMinimumChanges
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 2, "inputs": {"arr": [1, 4, 12, 14, 15, 18, 20, 24, 25, 25, 27, 33, 34, 42, 46, 48, 49, 50, 50, 52, 55, 56, 57, 58, 64, 65, 66, 69, 72, 75, 78, 80, 84, 90, 92, 95, 99], "n": 21}}, {"idx": 1, "outputs": 15, "inputs": {"arr": [-56, 6, -74, -30, 34, 40, -76, -10, -12, -86, -76, 36, -72, 82, 38, 68, 28, 84, 98, -84, 6, 16, -46, 8, 2, -18, -50, 4, -96, 88, -84, -38, -82, -54], "n": 22}}, {"idx": 2, "outputs": 5, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], "n": 6}}, {"idx": 3, "outputs": 10, "inputs": {"arr": [68, 79, 87, 44, 3, 99, 80, 6, 46, 67, 72, 40, 11, 18, 73, 48, 18, 72, 10, 38, 3, 39, 26, 76, 47, 15, 85, 69], "n": 15}}, {"idx": 4, "outputs": 4, "inputs": {"arr": [-96, -94, -94, -74, -68, -60, -58, -56, -56, -52, -52, -50, -44, -40, -26, -24, -10, -8, -6, -2, 2, 2, 12, 14, 20, 24, 26, 30, 38, 40, 52, 52, 62, 62, 68, 70, 74, 76, 80, 82, 90, 92], "n": 31}}, {"idx": 5, "outputs": 2, "inputs": {"arr": [1, 1, 1, 0, 1], "n": 3}}, {"idx": 6, "outputs": 0, "inputs": {"arr": [1, 5, 11, 20, 24, 28, 29, 31, 54, 58, 63, 65, 66, 71, 77, 80, 83, 92, 93, 93], "n": 12}}, {"idx": 7, "outputs": 2, "inputs": {"arr": [-50, -46, -44, -90, 2, -38, 88, -26, 60], "n": 7}}, {"idx": 8, "outputs": 1, "inputs": {"arr": [1, 1], "n": 1}}, {"idx": 9, "outputs": 9, "inputs": {"arr": [2, 1, 19, 26, 65, 47, 3, 65, 9, 12, 84, 59, 74, 59, 30, 83, 73, 67, 13, 5, 64, 83, 81, 92, 80, 14, 58, 84, 92], "n": 16}}]
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, Integer 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(1, 4, 12, 14, 15, 18, 20, 24, 25, 25, 27, 33, 34, 42, 46, 48, 49, 50, 50, 52, 55, 56, 57, 58, 64, 65, 66, 69, 72, 75, 78, 80, 84, 90, 92, 95, 99)), 21, 2);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-56, 6, -74, -30, 34, 40, -76, -10, -12, -86, -76, 36, -72, 82, 38, 68, 28, 84, 98, -84, 6, 16, -46, 8, 2, -18, -50, 4, -96, 88, -84, -38, -82, -54)), 22, 15);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)), 6, 5);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(68, 79, 87, 44, 3, 99, 80, 6, 46, 67, 72, 40, 11, 18, 73, 48, 18, 72, 10, 38, 3, 39, 26, 76, 47, 15, 85, 69)), 15, 10);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-96, -94, -94, -74, -68, -60, -58, -56, -56, -52, -52, -50, -44, -40, -26, -24, -10, -8, -6, -2, 2, 2, 12, 14, 20, 24, 26, 30, 38, 40, 52, 52, 62, 62, 68, 70, 74, 76, 80, 82, 90, 92)), 31, 4);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 1, 1, 0, 1)), 3, 2);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 5, 11, 20, 24, 28, 29, 31, 54, 58, 63, 65, 66, 71, 77, 80, 83, 92, 93, 93)), 12, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(-50, -46, -44, -90, 2, -38, 88, -26, 60)), 7, 2);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(1, 1)), 1, 1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(2, 1, 19, 26, 65, 47, 3, 65, 9, 12, 84, 59, 74, 59, 30, 83, 73, 67, 13, 5, 64, 83, 81, 92, 80, 14, 58, 84, 92)), 16, 9);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> arr, Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(arr, n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer 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__