Katkat

Compute maximum distinct-product pickup days

AmazonSoftware Engineer · Online Assessment

Last updated

This question evaluates a candidate's understanding of greedy and resource-allocation strategies along with combinatorial reasoning to maximize operations under discrete constraints.

Question

Given an array of positive integers representing quantities of different products, on day i (starting from

  1. you must pick exactly i distinct products, taking one unit from each chosen product. After each pick the chosen products' quantities decrease by 1 and cannot go below 0. Compute the maximum number of days the process can continue.