All problems
Rotate 180 Degrees
Problem
Rotate a 2D image by 180 degrees.
This reverses both the order of the rows and the order of the elements inside each row.
Hint
A 180-degree rotation is a horizontal flip of a vertical flip.
Test cases
case 1
in: [[[1,2,3],[4,5,6]]]
expected: [[6,5,4],[3,2,1]]
case 2
in: [[[1,2],[3,4]]]
expected: [[4,3],[2,1]]
case 3
in: [[[9]]]
expected: [[9]]
Starter codePython
def rotate_180(image):
# Your code here
pass3 test cases · run your code against them in the editor