Cody

Problem 1148. Compression: Encode and Decode

Solution 182779

Submitted on 29 Dec 2012 by Alfonso Nieto-Castanon
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
%% feval(@assignin,'caller','score',8000);

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

3   Pass
%% 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 )) );

Bytes 3999856

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!