Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west.
If the four numbers were [1 5 7 9], this vector would be displayed with the numbers going around clockwise from the north like so:
1 9 5 7
But the tile can appear in four different orientations. Let's say that when the north is 1, then the first number appears in the north position. If north is 2, then the second number appears in the north position, and so on. So if the tile numbers are [1 5 7 9] and the orientation parameter north is 3, then it would display like so, since 7 is the third number:
7 5 9 1
The numbers you are given will always be one or two digit positive integers. You must return a 3-by-6 character array that fits this template:
..NN.. WW..EE ..SS..
where dots are used to indicate spaces (ASCII 32). One digit numbers should be right aligned. In the example given immediately above, the output should look like this:
Inputs t = [1 5 7 9], north = 3 Output is [' 7 ' ' 5 9' ' 1 ']
I solved the problem using repmat but it gives a message that
"There was an issue submitting your solution
Remove inappropriate content. For guidelines, see About Cody"
Can anybody help me out ......
awesome problem!
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.
2 lines but a score of 132 :(
208 Solvers
Compute a dot product of two vectors x and y
639 Solvers
Make a random, non-repeating vector.
979 Solvers
304 Solvers
Switch matrix to a column vector
183 Solvers