Deployment Rack Packing

A deployment team packs identical server rack units into racks. Each unit is a pair [width, height] where width is how many rack columns it occupies and height is its height in rack units (RU).

The units are handed to the packer in a fixed order and must be placed in that exact order from left to right onto shelves, top to bottom. A unit cannot be reordered, rotated, or skipped.

Rules:

  • Each shelf has a fixed rackWidth of usable columns.
  • On one shelf, units are placed left to right; the combined width of the units on a shelf must never exceed rackWidth.
  • A shelf's height is the height of its tallest unit.
  • Shelves stack vertically: the total height of the rack is the sum of every shelf's height.

Return the minimum possible total rack height after packing all units.

Examples
Input: [[[1,1],[2,3],[2,3],[1,1],[1,1],[1,1],[1,2]],4]
Output: 6
Hints

Deployment Rack Packing

A deployment team packs identical server rack units into racks. Each unit is a pair `[width, height]` where `width` is how many rack columns it occupies and `height` is its height in rack units (RU).