sorry for cheating, David's entry made me do it :)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
fname = 'omphaloskeptic.m';
fid = fopen(fname);
file = textscan(fid,'%c', ...
'CommentStyle','%', ...
'Whitespace','');
fclose(fid);
ha = histc(file{1},1:128);
hp = omphaloskeptic;
assert(~any(ismember(33:41,find(ha))),'Used an illegal character');
assert(isequal(ha,hp),'Actual characters did not match prediction');
ans =
'function x=omphaloskeptic'
'x=0;a=[];'
'for i=1:128,a=[a;i];end'
'importdata omphaloskeptic.m'
'for i=[ans{:}],x=x+[i==a];end'
'end'
|
960 Solvers
116 Solvers
Project Euler: Problem 10, Sum of Primes
555 Solvers
263 Solvers
Convert a vector into a number
442 Solvers