Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
alphabet = 'al';
table = {'1','010'};
compressed = [93,85,127];
assert(isequal(decode(compressed,table,alphabet),'laaalalalaaaaaaa'))
|
2 | Pass |
alphabet = 'ehlo';
table = {'00','01','10','11'};
compressed = uint8([74 210 191]);
assert(isequal(decode(compressed,table,alphabet),'hellohellooo'))
|
3 | Pass |
alphabet = ',.kcgIblowaisnufhe try';
table = {'000000','000001','00001','000100','000101','000110','000111','001','010','01100','01101','0111','1000','10010','10011','10100','10101','1011','110','1110','11110','11111'};
compressed = uint8([27 179 198 146 236 197 238 174 234 222 29 117 111 217 83 5 201 121 11 190 167 232 179 64 52 60 132 189 245 60 210 198 254 48 92 157 245 63 69 154 110 75 22 245 131 182]);
assert(isequal(decode(compressed,table,alphabet),'It is not worth the bother of killing yourself, since you always kill yourself too late. '))
|
4 | Pass |
alphabet = char(randi(13)+96); alphabet=[alphabet alphabet+randi(13)];
table = {'1','010'};
n=randi(5)+2;
compressed = repmat([93,85,127],1,n);
assert(isequal(decode(compressed,table,alphabet),regexprep(regexprep(repmat('laaalalalaaaaaaa',1,n),'l',alphabet(2)),'a',alphabet(1)) ))
|
5 | Pass |
compressed = char(randi(26,1,42)+96);
alphabet = unique(compressed);
compressed = uint8(compressed);
table = cellstr(dec2bin(alphabet,8));
assert(isequal(decode(compressed,table,alphabet), char(compressed)));
|
248 Solvers
579 Solvers
546 Solvers
Make a random, non-repeating vector.
2796 Solvers
188 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!