title: Minimum Insertions Sort Array
signature: function minimumInsertionsSortArray($arr, $n) {
source_py: def minimum_insertions_sort_array(arr, N):
      lis = ([0] * N)
      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 (lis[i] < (lis[j] + 1))):
                  lis[i] = (lis[j] + 1)
      max = 0
      for i in range(N):
          if (max < lis[i]):
              max = lis[i]
      return (N - max)
source_cpp: int minimum_insertions_sort_array(vector<int> arr, int N) {
    int lis [ N ];
    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 ] && lis [ i ] < lis [ j ] + 1 ) lis [ i ] = lis [ j ] + 1;
    int max = 0;
    for ( int i = 0;
    i < N;
    i ++ ) if ( max < lis [ i ] ) max = lis [ i ];
    return ( N - max );
  }