Widget layout count
A dashboard editor drops widgets onto a fixed canvas. The canvas is panel_rows tall and panel_cols wide, and widget i covers a solid rectangle tile_widths[i] columns across and tile_heights[i] rows down. Widgets never rotate, never overlap, never hang off the canvas, and a saved layout places every widget and leaves no cell bare. Two layouts are the same layout when every cell carries a widget of the same size in both, because the editor stores sizes rather than widget identities and equal sized widgets are interchangeable. Return how many different layouts exist. Return 0 when the widget areas do not add up to the canvas area. A canvas with no cells and no widgets has exactly one layout, the empty one, so return 1 there. There are at most 8 widgets and at most 24 cells.
count_panel_tilings(panel_rows: int, panel_cols: int, tile_widths: list[int], tile_heights: list[int]) → int[2,3,[1,2],[2,2]]out2[2,4,[1,1,2,2],[2,2,1,1]]out3[2,2,[1,1,1,1],[1,1,1,1]]out1State 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.
[2,3,[1,2],[2,2]]2not run yetsample[2,4,[1,1,2,2],[2,2,1,1]]3not run yetsample[2,2,[1,1,1,1],[1,1,1,1]]1not run yetsample