As reported: Walmart Labs assessment (2026):
nmachine-learning models;cost[i]is the cost of modeliandfeatureAvailability[i]is a two-character binary string —"00"supports neither feature,"01"only feature B,"10"only feature A,"11"both. A selected set is k-capable if at leastkselected models support A and at leastksupport B (a"11"model counts for both). For everykfrom 1 ton, return the minimum total cost of a k-capable set, or-1if none exists.
Example 1
cost = [3, 5, 2, 4], featureAvailability = ["10", "01", "11", "00"]
-> [2, 10, -1, -1]
k = 1: the "11" model alone (cost 2). k = 2: it plus the "10" and the "01" model (2 + 3 + 5). k = 3 needs three models supporting A, but only two exist.
Example 2
cost = [1, 2, 3, 4, 5], featureAvailability = ["11", "10", "01", "10", "01"]
-> [1, 6, 15, -1, -1]
Constraints: 1 ≤ n ≤ 10^5; 1 ≤ cost[i] ≤ 10^9; each featureAvailability[i] is one of "00", "01", "10", "11". Totals can exceed 32 bits.
Code runner format: one JSON value per line: cost, then featureAvailability. Implement minCostForEachK(cost, featureAvailability) returning a list of n integers (answer for k = 1 … n); the harness prints it.