Given a rectangular area arrange a group of rectangles such that they cover the rectangular area entirely.
An integer denoting the height.
An integer denoting the width.
The dimensions of the rectangles consisting of the following form:
dare integers - any reasonable format is acceptable.
An exact cover of the rectangular area.
Rectangles used to cover the area are represented in the following way:
00 00 00
0 0 0
Each rectangle is represented using a character
0 is used for the first rectangle inputted
1 for the second and so on. The max number of rectangles given in input is therefore 10.
5 7 4x2,3x2,3x2,5x2,5x1
0000111 0000111 2233333 2233333 2244444
4 4 3x2,2x1,2x2,2x2
0001 0001 2233 2233
2 10 4x2,3x2,3x2
- The dimensions of the rectangles used to cover the region are interchangeable e.g. for
acould be the height or width same goes for
- If there are multiple solutions any of them is acceptable (just display 1).
- Assume all inputs are valid.
- You can have a full program or a function (inputs may be treated broadly as 3 separate arguments).
- Output to stdout (or something similar).
- This is code-golf so shortest answer in bytes wins.