title: Convert Strictly Increasing Array Minimum Changes
signature: function convert_strictly_increasing_array_minimum_changes(arr, 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.entry_fn_name: convert_strictly_increasing_array_minimum_changes
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(arr, n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(arr, n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver({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)
      print(string.format("TEST-0...%s",result))
  
      result = driver({-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)
      print(string.format("TEST-1...%s",result))
  
      result = driver({0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, 6, 5)
      print(string.format("TEST-2...%s",result))
  
      result = driver({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)
      print(string.format("TEST-3...%s",result))
  
      result = driver({-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)
      print(string.format("TEST-4...%s",result))
  
      result = driver({1, 1, 1, 0, 1}, 3, 2)
      print(string.format("TEST-5...%s",result))
  
      result = driver({1, 5, 11, 20, 24, 28, 29, 31, 54, 58, 63, 65, 66, 71, 77, 80, 83, 92, 93, 93}, 12, 0)
      print(string.format("TEST-6...%s",result))
  
      result = driver({-50, -46, -44, -90, 2, -38, 88, -26, 60}, 7, 2)
      print(string.format("TEST-7...%s",result))
  
      result = driver({1, 1}, 1, 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver({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)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
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}}]