Assign Tasks
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's "Assign Tasks" problem showed up in August 2024 OAs, and it's a greedy scheduling puzzle that trips up candidates who overthink the allocation logic. You've got workers with different speeds and tasks with different durations, and you need to assign them optimally. The catch is that the greedy choice (slowest worker gets longest task, fastest gets shortest) looks obvious but requires proof it actually minimizes completion time. StealthCoder can surface the pattern instantly if you blank on whether to sort ascending or descending.
Pattern and pitfall
The problem is fundamentally about pairing: match workers to tasks such that the maximum completion time across all workers is minimized. This is a classic greedy + sorting problem. The trick is recognizing that you want to pair the fastest worker with the longest task and the slowest with the shortest, then verify that swapping any pair increases the bottleneck. Many candidates reverse the sort order and waste 15 minutes debugging. The algorithmic shape is straightforward once you see it: sort both arrays, pair them (fastest with longest, or slowest with shortest depending on your indexing), and compute max completion. If you hit a wall during the live assessment, StealthCoder can confirm the sort direction in seconds so you don't spiral.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Assign Tasks 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 by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Amazon's OA.
Amazon reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Assign Tasks FAQ
Is this really just sorting and pairing?+
Yes. Sort workers and tasks, pair them in a specific order (greedy), compute completion time for each worker, return the max. The rigor is in why that pairing order is optimal, not the implementation. Understanding the swap argument helps you stay confident.
What's the most common mistake on this problem?+
Reversing the sort order. Candidates second-guess whether to pair fastest with longest or shortest, then flip it mid-solution. Lock in the logic before you code: slowest worker should do the easiest task to avoid bottlenecks.
How do I verify my answer is right?+
After pairing, manually compute completion time for each worker (task duration divided by worker speed). The maximum of those times is your answer. Test with a small example to confirm no swap improves it.
Does this pattern appear in other Amazon OAs?+
Greedy + sorting is very common at Amazon. Once you see the pairing insight here, you'll recognize it in resource allocation and load-balancing problems. The shape stays consistent across variations.
Can I solve this without fully understanding the proof?+
Technically yes if you memorize the greedy rule, but Amazon likes you to explain the logic. If you blank on the reasoning, just implement the pairing and test it. Being able to code and verify is often enough.