The Maximum Number of Achievable Transfer Requests coding problem gives you n buildings and a list of transfer requests, where each request moves one employee from one building to another. You want to satisfy as many requests as possible such that at the end, every building's net employee count change is zero (the building population returns to its original state). This is a constraint satisfaction maximization problem.
Amazon uses this problem to test bit manipulation enumeration on small-scale inputs (n ≤ 20 requests). While the constraint n ≤ 20 immediately suggests bitmask enumeration, the verification step (checking zero net change for all buildings) requires careful implementation. It rewards candidates who recognize the upper bound on complexity and implement the check cleanly.
Bitmask enumeration: Enumerate all 2^n subsets of requests. For each subset, compute the net change in employee count for each building (each accepted request adds one to the destination and removes one from the source). If all buildings have zero net change, count the number of set bits (accepted requests) and update the maximum. Total complexity: O(2^n * (n + buildings)).
With n ≤ 20 (though typically n ≤ 16), this is about 1 million iterations — very feasible.
Buildings: 5. Requests: [[0,1],[1,0],[0,1],[1,2],[2,0],[3,4]]
For the Array Enumeration Backtracking Bit Manipulation interview pattern, bitmask enumeration with feasibility check is the go-to template when n ≤ 20. Always state the complexity explicitly (2^n * verification_cost) to show you've analyzed it. This pattern appears in many NP-hard problems where small n makes brute force feasible.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Maximum Good People Based on Statements | Hard | Solve | |
| Count Number of Maximum Bitwise-OR Subsets | Medium | Solve | |
| Maximum Points in an Archery Competition | Medium | Solve | |
| Maximum Rows Covered by Columns | Medium | Solve | |
| Maximum Possible Number by Binary Concatenation | Medium | Solve |