Max Number of Products You can Pick
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's February OA is asking you to pick products and maximize some count or value. The problem title suggests you're iterating through a list or array to find the best subset. This is a classic greedy or dynamic programming trap. You'll feel pressure to code a brute-force scan, but the real ask is spotting the constraint that lets you prune the search space. StealthCoder reads the full problem in real time, so if the exact rule isn't clear on first read, you have a safety net. Know the difference between 'max items I can afford' and 'max profit from items I can take' before you start.
Pattern and pitfall
The pattern here is almost certainly greedy or dynamic programming, depending on whether items have weights, costs, or dependencies. If there's a weight limit or budget, it's a variant of the knapsack problem. If it's just 'pick the top N by some metric,' it's sorting plus a linear scan. The trick Amazon loves: the constraint isn't always explicit in the problem title. Read for hidden limits like 'each product can only be picked once' or 'you have a weight limit.' The common miss is coding a solution that works for unlimited picks when the actual problem bans duplicates. When you hit the live OA, StealthCoder will catch the constraint you skim on screen, so you can adjust logic fast. Focus on the problem text, not the title.
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 Max Number of Products You can Pick 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.
Max Number of Products You can Pick FAQ
Is this a knapsack problem?+
Probably yes, but it depends on whether you have a constraint like weight, cost, or count limit. If you're picking items and have a budget or capacity, it's knapsack or a greedy variant. If it's just 'count how many you can take,' it's simpler. Read for the limiting factor first.
What if I can't figure out the exact constraint?+
Ask yourself: is there a limit on how many items, total weight, total cost, or something else. If the OA lets you ask clarifying questions, use that. If not, code the greedy version first (sort and pick the best), then refine if it fails test cases.
How do I prepare in 24 hours?+
Don't memorize knapsack solutions. Instead, practice one greedy sort problem and one DP knapsack. Understand the trade-off: greedy is O(n log n), DP is O(n*W) where W is the capacity. Know when each applies. That's enough.
Is this problem still asked at Amazon?+
Yes. Reported in February 2025. Amazon loves inventory, selection, and optimization problems. Expect similar product-picking or resource-constraint variants to keep showing up.
What's the most common mistake?+
Ignoring the constraint and writing a solution that picks unlimited items or ignores a weight or budget limit. Always reread the problem statement for 'at most,' 'cannot exceed,' or 'only one per type.' That detail changes the whole approach.