Get Minimum Boxes

Problem Overview

  • Find the minimum number of boxes to unload so the remaining boxes satisfy max(boxes) ≤ capacity * min(boxes).
  • Input: int[] boxes (sizes), int capacity; Output: int count of boxes to unload.
  • Constraints: n up to 1e5, box size up to 5e5 (partial).
  • Real-world context: Amazon warehouse truck loading in supply chain.
  • Amazon interviews coding interview problem and interview question on arrays.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: