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