dp ( i , j ) represents the minimum number of operations needed to make the array [ 0 . . i ] sorted in non - decreasing order given that ith element is j
int [ ] [ ] dp = new int [ n ] [ large + 1 ] ;