Company: Zomato
Difficulty: medium
Model Capacity Partitioning In a machine learning project, there are n computational units, each with its unique computational capacity, represented by an array called storage . These computational units are used in training machine learning models. The objective is to create exactly k model instances using the following process: Partition the array of computational units into k subarrays, ensuring that each subarray forms a valid permutation and subarrays do not intersect. Each partitioned subarray corresponds to one machine learning model, and the length of the permutation determines the computational capacity of the model. An array, modelCap , is generated that contains the computational capacity of each of the models. It is not always possible to create exactly k models with the given computational units, so the project allows replacing some computational units with others that may have any computational capacity. The goal is to find the minimum number of replacements ( minOp ) nee