All problems
Flip Matrix Vertically
Problem
Return matrix A with its rows reversed (flip upside down), also known as flipud.
The first row becomes the last and vice versa.
Hint
Reverse the order of the rows without touching entries inside rows.
Test cases
case 1
in: [[[1,2],[3,4]]]
expected: [[3,4],[1,2]]
case 2
in: [[[1,2,3],[4,5,6],[7,8,9]]]
expected: [[7,8,9],[4,5,6],[1,2,3]]
case 3
in: [[[1]]]
expected: [[1]]
case 4
in: [[[1,2,3]]]
expected: [[1,2,3]]
Starter codePython
def flip_vertical(A):
# Your code here
pass4 test cases · run your code against them in the editor