I might have misunderstood the statement, but to me the second test is wrong and td should be defined by
td = [' 8 '
' 5 27'
' 46 '];
I believe the test is correct; if north is 4 then the fourth number (46 for test 2) should appear in the north position (not 8, which is the second number)
Ah! I misunderstood the question then; I thought that there was a rotation in directions according to the north parameter, whereas the latter indicates which of the four numbers should be placed in the north position.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
t = [1 5 7 9];
north = 3;
td = [' 7 '
' 5 9'
' 1 '];
assert(isequal(rotate_tile(t, north),td))
|
2 | Fail |
%%
t = [27 8 5 46];
north = 4;
td = [' 46 '
' 5 27'
' 8 '];
assert(isequal(rotate_tile(t, north),td))
Error: Assertion failed.
|
3 | Fail |
%%
t = [9 57 75 9];
north = 2;
td = [' 57 '
' 9 75'
' 9 '];
assert(isequal(rotate_tile(t, north),td))
Error: Assertion failed.
|
Project Euler: Problem 2, Sum of even Fibonacci
835 Solvers
Flip the main diagonal of a matrix
506 Solvers
Generate N equally spaced intervals between -L and L
563 Solvers
Given a 4x4 matrix, swap the two middle columns
516 Solvers
530 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!