This could be quite a good solution, if you removed the "x = 7; %" part and just left what is now a comment. As it is, although it satisfies the test case, it doesn't actually solve the problem.
... though, just to be clear, the comment wouldn't be quite right, it still needs a little adjustment.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
xy = [3,4; 0,0; 0,1; 1,1];
z_correct = 7;
assert(isequal(walked(xy),z_correct))
|
2 | Fail |
%%
xy = [3,4; 0,0];
z_correct = 5;
assert(isequal(walked(xy),z_correct))
Error: Assertion failed.
|
3 | Fail |
%%
xy = [0,0; 5,12; 0,12];
z_correct = 18;
assert(isequal(walked(xy),z_correct))
Error: Assertion failed.
|
Find the peak 3n+1 sequence value
1107 Solvers
495 Solvers
Who has power to do everything in this world?
318 Solvers
347 Solvers
548 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!