Cody

Problem 535. Rotate and display numbered tile

Solution 2142819

Submitted on 27 Feb 2020 by Nikolaos Nikolaou
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   Pass
t = [1 5 7 9]; north = 3; td = [' 7 ' ' 5 9' ' 1 ']; assert(isequal(rotate_tile(t, north),td))

l1 = 55 l2 = 53 l3 = 57 l4 = 49 td = ' 7 ' td = 2×6 char array ' 7 ' ' 5 9' td = 3×6 char array ' 7 ' ' 5 9' ' 1 '

2   Pass
t = [27 8 5 46]; north = 4; td = [' 46 ' ' 5 27' ' 8 ']; assert(isequal(rotate_tile(t, north),td))

l1 = 52 54 l2 = 53 l3 = 50 55 l4 = 56 td = ' 46 ' td = 2×6 char array ' 46 ' ' 5 27' td = 3×6 char array ' 46 ' ' 5 27' ' 8 '

3   Pass
t = [9 57 75 9]; north = 2; td = [' 57 ' ' 9 75' ' 9 ']; assert(isequal(rotate_tile(t, north),td))

l1 = 53 55 l2 = 57 l3 = 55 53 l4 = 57 td = ' 57 ' td = 2×6 char array ' 57 ' ' 9 75' td = 3×6 char array ' 57 ' ' 9 75' ' 9 '

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!