Squares should all have the same dimension. The ratio constraint is that the length of the rectangle should be equal to its width (a square) or no more than two times its width (2:1 ratio). The algorithm should minimize the uncovered area. For the same uncovered area, a ratio closer or equal to 2:1 should be preferred.
I can't wrap my head around it. :) The practical aim is to automate the creation of an image, the square tiles are pictures. There can be 1 square to no more than a couple hundreds so I could brute force all the possibilities and check for constraints but is there a more elegant solution?
Thanks.