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
var dp = new Array ( n ) ; var i , j ; for ( i = 0 ; i < dp . length ; i ++ ) dp [ i ] = new Array ( large + 1 ) ;