Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%% Clean workspace
% !/bin/cp fib.m safe
% !/bin/rm *.*
% !/bin/mv safe fib.m
% Clean user's function from some known jailbreaking mechanisms
functions={'!','feval','eval','str2func','str2num','regex','system','dos','unix','perl','assert','fopen','write','save','setenv','path','please','for','if','while','switch','global','figure'...
'round','roundn','fix','ceil','char','floor','\.','^','pow','\^','sscanf','persistent'};
fid = fopen('fib.m');
st = char(fread(fid)');
for n = 1:numel(functions)
st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %','ignorecase');
end
fclose(fid);
fid = fopen('fib.m' , 'w');
fwrite(fid,st);
fclose(fid);
|
2 | Pass |
%%
n = 2;
f = fib(n);
assert(isequal(f() + f(),f()));
assert(isequal(f(),5));
|
3 | Pass |
%%
n = 7;
f = fib(n);
assert(isequal(f() + f(),f()));
assert(isequal(f() + f(),f()));
assert(isequal(f(),233));
|
831 Solvers
The Hitchhiker's Guide to MATLAB
2874 Solvers
242 Solvers
154 Solvers
432 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!