Given an array of products in which each product has an attribute name, width, and height, and given a sheet of paper that has width x and height y, write a program that returns the number of sheets of paper needed to print out the array of products ,面试官为了简化题目,不用优化,按照array的顺序打印就行,求问怎么做?我看面试官的意思,这个题很简单。。
如果某个product的 width 超过x 该怎么办?
忘记了,不会超过的~
按照顺序打印很简单吧,在同一个行的按照 max height 就行了
您能具体说说吗?感谢
已经具体说了啊
你换下一行的时候,上一行会有几个product,取它们的最大的height来作为下一行的开始
好像很有道理,感谢