Min Retailers
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's "Min Retailers" question is hitting OAs in March 2025, and it's a greedy or dynamic-programming trap. You get a set of products, retailers, and prices, then you need to find the minimum number of retailers to buy from to get all products. The trick is that it's not always obvious whether to sort by price, by product coverage, or by some hybrid metric. StealthCoder will pattern-match this instantly and show you the solution in real time if you blank on the approach during the live assessment.
Pattern and pitfall
This is a set-cover variant, which means greedy often fails. The naive approach is to pick the retailer with the most uncovered products each round, but that's not optimal. The real solution usually requires either dynamic programming with bitmasks (if the product count is small, say under 20) or a careful greedy with cost-aware tie-breaking. The gotcha is that retailers have different price distributions, so you can't just count products. You need to track which combinations of retailers minimize total cost while covering all items. StealthCoder solves this by recognizing the set-cover structure and applying the right DP or branch-and-bound strategy immediately.
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 Min Retailers 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.
Min Retailers FAQ
Is this asking for min retailers or min cost?+
The problem title says "Min Retailers", so the primary goal is the number of retailers. If it also asks for min cost as a tiebreaker, that changes the approach to a weighted set-cover. Clarify the exact objective in the problem statement before coding.
How many products and retailers should I expect?+
Without the full problem text, assume products are under 20 (bitmask DP is feasible) and retailers are under 100. If either is much larger, you'll need a greedy approximation instead of exact DP.
Will a greedy approach get accepted?+
Greedy usually fails on set-cover. If you pick retailers by "most uncovered products", you'll often get suboptimal results. Always code DP with bitmasks first if product count is small enough.
What's the most common mistake?+
Forgetting that a retailer can supply multiple products, so you have to track which products are covered by which retailers before you start selecting. Build the retailer-to-products map first.
Can I solve this in 48 hours of prep?+
Yes. Study set-cover, understand bitmask DP (2^n * m transitions), and code one clean solution. If you're rusty on bitmasks, practice subset enumeration for 30 minutes. Then trust the pattern during the live OA.