Function to initialize the dp and call solveUtil ( ) method to get the answer
static int solve ( string str , int K ) { int N = str . Length ; dp = new int [ N , K ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < K ; j ++ ) { dp [ i , j ] = - 1 ; } }