Company: Agoda
Difficulty: medium
Consolidating Partitions Given the space currently used on each partition of an existing drive and the total capacity of each partition, determine the minimum number of partitions needed to hold all the data. There are two arrays given as inputs, used and totalCapacity . The first array represents the space used in each partition, and the second represents the total capacity of each partition. Return the minimum number of partitions required to accommodate all the data without exceeding any partition's total capacity. Function Description Complete the function minPartitions with the following parameters: int used[] : the amount of space used in each partition int totalCapacity[] : the total capacity of each partition Returns: int : the minimum number of partitions needed to store all the data Constraints 1 ≤ n ≤ 1000 1 ≤ used[i] ≤ 1000 1 ≤ totalCapacity[i] ≤ 1000 Example Input: used = [3, 2, 1, 3, 1] totalCapacity = [3, 5, 3, 5, 5] The data can be moved around like so: Move all the dat