Server Selection
Reported by candidates from Point72's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Point72 reported this one in July 2026, and the detail that matters is right in the statement: every server capacity is a power of 2. That's the whole question. You pick the fewest servers that sum to exactly expected_load, each used once, with duplicates allowed as separate choices. It looks like subset sum, and subset sum would blow up at 100000 elements. It isn't. It's a greedy bit problem in disguise. If you blank on the setup during the OA, StealthCoder sits invisibly on your screen as a safety net and hands you the approach in real time.
The problem
You are given an array server, where server[i] is the request-handling capacity of one server. Every capacity is a power of 2. You are also given a target load expected_load. Return the minimum number of servers whose capacities sum to exactly expected_load. Return -1 if no such selection exists. For this exercise, assume the following selection rules: Each array element represents a separate server that may be selected at most once. Servers with equal capacities remain separate choices. A selected server contributes its entire capacity; capacities cannot be split or partially used. A total greater than expected_load is not valid. If expected_load is 0, the empty selection is valid and the answer is 0. The callable minimumServers(server, expected_load) returns only the minimum count, not the selected indices. The target uses a long integer in Java and a long long integer in C++. Function minimumServers(server: int[], expected_load: long) → int Examples Example 1 server = [1,2,8,4,2] expected_load = 13 return = 3 Select capacities 8, 4, and 1, totaling 13. The two largest servers total only 12, so fewer than three cannot work. This is an authored practice example. Example 2 server = [2,2,8] expected_load = 7 return = -1 Every possible total is even, so no selection totals 7. The server with capacity 8 cannot be used partially. This is an authored practice example. Example 3 server = [16,8,4] expected_load = 0 return = 0 Select no servers to meet the zero load. This is an authored practice example. Constraints 1 <= server.length <= 100000. For this exercise, assume server[i] = 2^b for an integer b with 0 <= b <= 30. For this exercise, assume 0 <= expected_load <= 10^15.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick: count how many servers exist at each power, cnt[b] for b from 0 to 30. Then walk the bits of expected_load from the lowest. If bit b is set, you need one server of 2^b. If cnt[b] is 0, you can't use a smaller leftover to cover it, so you must break a bigger one, which doesn't work because you can't split. Better approach: go from the highest power down. Keep a remaining target, and at each b take min(cnt[b], remaining / 2^b) servers. Since capacities are powers of 2, taking the biggest fit is optimal. If remaining ends at 0, return the count, else -1. Pitfalls: use long for the target, since it goes up to 10^15, and the loads above 2^30 times 100000 still fit in long. Handle expected_load 0 first and return 0. StealthCoder is your hedge if the greedy proof slips your mind live.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Server Selection cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Point72's OA.
Point72 reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Server Selection FAQ
How hard is Point72 Server Selection really?+
Easy to medium once you see the power-of-2 structure. The hard part is not reaching for subset sum or knapsack. With 100000 servers and a target up to 10^15, only a greedy or bit-counting approach runs in time.
What's the trick to solve it?+
Bucket servers by exponent, then go from the largest power to the smallest. At each power, take as many servers as fit into the remaining load, capped by how many you have. If the remainder isn't zero at the end, return -1.
Why does greedy work here?+
Every capacity divides every larger capacity. So any set of smaller servers that fills a gap can't beat one larger server that fits, because the larger one uses fewer picks. Taking the largest fit never blocks a valid solution.
What edge cases should I test?+
expected_load of 0 returns 0. A target odd when no capacity 1 exists returns -1. Targets above the total capacity return -1. Duplicate capacities count as separate servers. Use long for the target and remaining value to avoid overflow.
How do I prepare in 48 hours for this OA?+
Practice greedy problems built on coin-style denominations and bit counting. Write this one from scratch once, with a count array of size 31. Then run the three given examples plus a large target case to confirm there's no overflow.