dp [ i ] [ j ] stores maximum possible number of people among arr [ 0. . i - 1 ] can vote in j time .
int [ ] [ ] dp = new int [ n + 1 ] [ x + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { for ( int j = 0 ; j < x + 1 ; j ++ ) { dp [ i ] [ j ] = 0 ; } }