Otherwise
else { ans = Math . min ( ans , 1 + solve ( s , n , idx + 1 , k , s [ idx ] . charCodeAt ( ) , 1 ) ) ; } dp [ idx ] [ k ] [ last - ' ' . charCodeAt ( ) ] [ count ] = ans ; return dp [ idx ] [ k ] [ last - ' ' . charCodeAt ( ) ] [ count ] ; }