title: Convert Strictly Increasing Array Minimum Changes
signature: fun convertStrictlyIncreasingArrayMinimumChanges(arr: ArrayList<Int>, n: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(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)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-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)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1), 6, 5)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-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)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(1, 1, 1, 0, 1), 3, 2)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(1, 5, 11, 20, 24, 28, 29, 31, 54, 58, 63, 65, 66, 71, 77, 80, 83, 92, 93, 93), 12, 0)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-50, -46, -44, -90, 2, -38, 88, -26, 60), 7, 2)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(1, 1), 1, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(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)
      println("TEST-9...${result}")
      
          
  }
  
  main()
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;
  }