As reported: Nutanix IC4/5 online assessment on HackerRank (2026): three questions in two hours. Question 1, "Maximum Quantity (Machines + maxPower)": given
power[i]andquantity[i], choose a subset withsum(power) ≤ maxPowerthat maximizessum(quantity)— a 0/1 knapsack, where meet-in-the-middle is the optimal approach for the constraints.
There are n machines; machine i uses power[i] and produces quantity[i]. Choose any subset of machines whose total power is at most maxPower, maximizing the total quantity. Return that maximum (0 if no machine fits).
Example 1
power = [2,3,4,5], quantity = [3,4,5,6], maxPower = 5 -> 7 (machines 0 and 1)
Example 2
power = [10,20,30], quantity = [60,100,120], maxPower = 50 -> 220
Constraints: 1 ≤ n ≤ 30; 1 ≤ power[i], quantity[i] ≤ 10^9; 0 ≤ maxPower ≤ 3 · 10^10 — power values are far too large for a DP over capacities.
Code runner format: one JSON value per line: power, quantity, maxPower. Implement maxQuantity(power, quantity, maxPower); the harness prints the total (64-bit).