Please review this detail documnet Data Platform Considerations
The solution has:
- function
clockwiseMatrix
- CI pipeline
- linting
- testing
- formating
Write a function that, given a matrix of integers, builds a string with the entries of that matrix appended in clockwise order.
Feel free to use any language you would like, but here is an example function signature def clockwiseMatrix(input):
input = [[2, 3, 4, 8],
[5, 7, 9, 12],
[1, 0, 6, 10]]
clockwiseMatrix(input)
>>2, 3, 4, 8, 12, 10, 6, 0, 1, 5, 7, 9
input = [[1, 2],
[3, 4]]
clockwiseMatrix(input)
>>1,2,4,3
How can you verify that your solution is correct?
Let’s look the first example:
[[2, 3, 4, 8],
[5, 7, 9, 12],
[1, 0, 6, 10]]
I’ve assigned coordinates for each element, my goal is to go through the elements clockwise and print the elements in the order:
The matrix has the following attributes:
- w - width of matrix (number of columns)
- h - height of matrix (number of rows)
- x,y - coordinates of each element, such as 0,0;0,1;0,2 and so on.
The function codes: