take the max set size from dp [ N - 1 ] [ 0 ] to dp [ N - 1 ] [ MAX ]
var maxSetSize = - 1 ; for ( var i = 0 ; i < MAX ; i ++ ) maxSetSize = Math . max ( maxSetSize , dp [ N - 1 , i ] ) ; return N - maxSetSize ; }