Max square size for unknown number inside rectangle

前端 未结 10 533
陌清茗
陌清茗 2020-12-03 07:58

If I have a set of tiles (squares) which can be any number and they are to fill a container (rectangle) of an unknown size how do I work out the maximum size of the tiles wi

10条回答
  •  生来不讨喜
    2020-12-03 08:56

    This is a packing problem. Optimal solutions are hard to find. See for example Packing N squares in a square.

    You can compute an (optimistic) upper bound by dividing the total surface by the number of squares: sqrt(width*height/n).

提交回复
热议问题