Function to return minimum run - length encoding for string s by removing atmost k characters
function MinRunLengthEncoding ( s , n , k ) { for ( let i = 0 ; i < maxN ; i ++ ) { dp [ i ] = new Array ( maxN ) ; for ( let j = 0 ; j < maxN ; j ++ ) { dp [ i ] [ j ] = new Array ( 27 ) ; for ( let k = 0 ; k < 27 ; k ++ ) { dp [ i ] [ j ] [ k ] = new Array ( maxN ) ; for ( let l = 0 ; l < maxN ; l ++ ) { dp [ i ] [ j ] [ k ] [ l ] = - 1 ; } } } } return solve ( s , n , 0 , k , 123 , 0 ) ; }