Cody

Problem 464. Function Sniffer

Solution 3491189

Submitted on 31 Oct 2020
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   Fail
x = 'x=cos(theta); y=sin(beta);' y_correct = 'cos sin'; assert(isequal(sniffing(x),y_correct))

x = 'x=cos(theta); y=sin(beta);' x = 8×1 cell array {'x' } {'cos' } {'theta)'} {0×0 char} {'y' } {'sin' } {'beta)' } {0×0 char} y = 'cos sin x y'

Assertion failed.

2   Fail
x = 'x=sum(1:100); y=sqrt(x);' y_correct = 'sqrt sum'; assert(isequal(sniffing(x),y_correct))

x = 'x=sum(1:100); y=sqrt(x);' x = 8×1 cell array {'x' } {'sum' } {'1:100)'} {0×0 char} {'y' } {'sqrt' } {'x)' } {0×0 char} y = 'sqrt sum x y'

Assertion failed.

3   Fail
x = 'x=ones(round(7.7))-rand;' y_correct = 'ones rand round'; assert(isequal(sniffing(x),y_correct))

x = 'x=ones(round(7.7))-rand;' x = 6×1 cell array {'x' } {'ones' } {'round' } {'7.7))' } {'rand' } {0×0 char} y = 'ones rand round x'

Assertion failed.

Suggested Problems

More from this Author100

Community Treasure Hunt

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

Start Hunting!