Walmart·Software Engineer·Online Assessment (OA)
- You have n ML models, each with a cost and a binary string indicating whether it supports Feature A, Feature B, both, or neither. For each k from 1 to n, find the minimum total cost to select a set of models that includes at least k supporters of Feature A and at least k supporters of Feature B. A model supporting both counts toward either requirement. Return -1 if a given k is impossible.
“Spent the first ten minutes just re-reading the problem because the dual-counting on '11' models kept tripping me up.”