Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-190

Window Reverse

Problem

Reassemble padded windows into the full padded image.

Given the windows in row-major order, the window size and the padded height h and width w (multiples of window), stitch each window back into place.

Test cases

case 1
in: [[[[1,2],[4,5]],[[3,0],[6,0]],[[7,8],[0,0]],[[9,0],[0,0]]],2,4,4]
expected: [[1,2,3,0],[4,5,6,0],[7,8,9,0],[0,0,0,0]]
case 2
in: [[[[1,2],[3,4]]],2,2,2]
expected: [[1,2],[3,4]]
case 3
in: [[[[1,2],[5,6]],[[3,4],[7,8]]],2,2,4]
expected: [[1,2,3,4],[5,6,7,8]]
Starter codePython
def window_reverse(windows, window, h, w):
    # Your code here
    pass

3 test cases · run your code against them in the editor