Your question is Server Grouping to Target. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Nutanix Prism Central needs to select servers whose available request capacities meet an exact target. Given a list of nonnegative server capacities and a target T, return indices of a subset with the minimum number of servers whose capacities sum exactly to T. Return any valid minimum-size subset. If no subset exists, return an empty list.
The empty subset is valid when T = 0.
Implement minimum_servers(capacities, T), where capacities is a list of nonnegative integers and T is a nonnegative integer. Return a list of distinct zero-based indices. The selected capacities must sum to T, and no smaller valid subset may exist.
def minimum_servers(capacities, T):