To check whether a particular state of dp has been solved
var v = Array ( n ) ; for ( var i = 0 ; i < n ; i ++ ) { v [ i ] = Array ( n ) ; for ( var j = 0 ; j < n ; j ++ ) { v [ i ] [ j ] = Array ( MAX ) ; } }