All problems
Image to Flat List
Problem
Flatten a 2D image into a 1D list in row-major order.
Rows are emitted top to bottom and values inside each row left to right. An empty image returns [].
Test cases
case 1
in: [[[1,2,3],[4,5,6]]]
expected: [1,2,3,4,5,6]
case 2
in: [[[7]]]
expected: [7]
case 3
in: [[]]
expected: []
case 4
in: [[[1,2],[3,4],[5,6]]]
expected: [1,2,3,4,5,6]
Starter codePython
def flatten_image(image):
# Your code here
pass4 test cases · run your code against them in the editor