Thanks Marko ,My level is limited, I can only learn about your lisp.
1, the area or the X direction from large to small array.
2, according to the order of the different working surface, the height is not more than the height of the ladder. The last loop to find the most suitable small rectangle into the rectangle.