Back to problems

Minimize Operations to Balance Shipments

Algorithm · JPMorgan · Medium

A shop owns n categories of goods. The integer array quantity has length n, and quantity[i] is the positive stock count of category i. For shipping, the categories are split into two contiguous non-empty groups at an index j with $$1 \le j < n$$: The first group contains categories 0 through j - 1. The second group contains categories j through n - 1. All units of one category must stay together in the same group. Before shipping, you may adjust stock counts. In one…

Checking your access…