Problem 1148. Compression: Encode and Decode

Solution 1842665

Submitted on 8 Jun 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass

2   Pass
filetext = fileread('encode_decode.m'); % Avoid Size 0 solutions assert(isempty(strfind(filetext, 'persistent'))) assert(isempty(strfind(filetext, 'global')))

3   Fail
x=randi(2^32-1,1000); dirfiles_orig=dir; num_orig=size(dirfiles_orig,1); fname=encode_decode(x); dirfiles=dir; num_encode=size(dirfiles,1); c=dir(fname); fprintf('Bytes %i\n',c.bytes) file_size=floor(c.bytes/1000); assert(num_encode==num_orig+1,'Virus Detected'); xout=encode_decode(fname); assert(file_size<4100,sprintf('File Size %i\n',file_size)) assert(isequal(x,xout),'xout ~= x') feval( @assignin,'caller','score',floor(min( 8000,file_size )) );


Error using / Not enough input arguments. Error in Test3 (line 14) file_size=floor(c.bytes/1000);