You are given an array books where books[i] = [thickness_i, height_i] represents the thickness and height of the book at index i. You are also given an integer shelfWidth.
Books must be arranged in order onto horizontal shelves. Each shelf can hold books with a total thickness of at most shelfWidth. When placing a book on a shelf, its height contributes to the shelf height, which is the maximum height among all books placed on that shelf. If placing the next book would exceed shelfWidth on the current shelf, or if you choose to start a new shelf, you can place it on a new shelf below the current one.
Return the minimum possible total height of the entire bookcase after placing all the books in the given order.
Constraints:
books.length
thickness_i shelfWidth
height_i
You are given an array books where books[i] = [thickness_i, height_i] represents the thickness and height of the book at index i. You are also given an integer shelfWidth.
Books must be arranged in order onto horizontal shelves. Each shelf can hold books with a total thickness of at most shelfWidth. When placing a book on a shelf, its height contributes to the shelf height, which is the maximum height among all books placed on that shelf. If placing the next book would exceed shelfWidth on the current shelf, or if you choose to start a new shelf, you can place it on a new shelf below the current one.
Return the minimum possible total height of the entire bookcase after placing all the books in the given order.
Constraints:
books.length
thickness_i shelfWidth
height_i