All problems
Shifted Window Partition Count
Problem
Count the windows a Swin window partition produces, including the shifted partition.
The image is padded to a multiple of window and every position belongs to exactly one window, so the count is ceil(h / window) * ceil(w / window). Return that integer.
Test cases
case 1
in: [14,14,7]
expected: 4
case 2
in: [16,16,7]
expected: 9
case 3
in: [224,224,7]
expected: 1024
case 4
in: [8,4,4]
expected: 2
Starter codePython
def window_partition_count(h, w, window):
# Your code here
pass4 test cases · run your code against them in the editor