Count bitmaps from runs
An icon editor stores a black and white bitmap by its run headers instead of its pixels. row_runs[r] lists, left to right, the lengths of the runs of dark pixels in row r, and col_runs[c] does the same top to bottom for column c. Runs in the same line are separated by at least one light pixel, and an empty header means that line has no dark pixels at all. The bitmap has one row per entry of row_runs and one column per entry of col_runs. Return how many bitmaps carry exactly these headers. Return 0 when none does. A bitmap with no rows and no columns has one header set, the empty one, so return 1 there. The bitmap is at most 6 rows by 7 columns and every run length is positive.
count_matching_bitmaps(row_runs: list[list[int]], col_runs: list[list[int]]) → int[[[1],[1]],[[1],[1]]]out2[[[3],[1,1],[3]],[[3],[1,1],[3]]]out1[[[1]],[[1],[1]]]out0State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[[[1],[1]],[[1],[1]]]2not run yetsample[[[3],[1,1],[3]],[[3],[1,1],[3]]]1not run yetsample[[[1]],[[1],[1]]]0not run yetsample