Problem
Given a n x m two-dimensional array numbers and a rotation angle rotate (which can be 90, 180, or 270), write a function solution that returns the entire two-dimensional array rotated clockwise by the specified rotate angle.
For example, given the following two-dimensional array numbers and integer rotate:
numbers = [
[13,15],
[15, 7],
[ 3,13]
]
rotate = 90
Rotating this two-dimensional array clockwise by 90 degrees results in:

The returned two-dimensional array is:
rotated_numbers = [
[ 3,15,13],
[13, 7,15]
]
Constraints
- The dimensions of
numbers(nandm) are between 1 and 20 inclusive.nandmcan be different. - Each element
numbers[i][j]is a natural number between 1 and 1000 inclusive. - The
rotateparameter is one of90,180, or270.
Test Case
| Test Case Number | numbers | rotate | return |
|---|---|---|---|
| 1 | [[13,15],[15,7],[3,13]] | 90 | [[3,15,13],[13,7,15]] |
| 2 | [[3,13,17,14,13],[1,18,16,19,7],[5,6,11,15,4],[14,18,15,4,18],[4,16,5,15,2]] | 270 | [[13,7,4,18,2],[14,19,15,4,15],[17,16,11,15,5],[13,18,6,18,16],[3,1,5,14,4]] |
| 3 | [[19,8,13]] | 180 | [[13,8,19]] |
Explanation for Test Case 1
- This is identical to the example given in the problem.
Explanation for Test Case 2
- The situation provided in the problem is illustrated as follows:

Explanation for Test Case 3
- The situation provided in the problem is illustrated as follows:
