MEDIUMasked at 2 companies

Shopping Offers

A medium-tier problem at 52% community acceptance, tagged with Array, Dynamic Programming, Backtracking. Reported in interviews at MathWorks and 1 others.

Founder's read

Shopping Offers is a medium-difficulty problem that hits your assessment unprepared because it blends multiple paradigms: bitmask state tracking, dynamic programming, and backtracking. MathWorks and Coupang have both asked it. The acceptance rate sits just above 50 percent, meaning half the room flubs it under time pressure. The trap is thinking you need to brute-force every combination of items. You don't. The real pattern is encoding item counts as a bitmask state, then memoizing the minimum cost to reach each state. If you freeze during the live OA, StealthCoder surfaces the solution invisible to the proctor.

Companies asking
2
Difficulty
MEDIUM
Acceptance
52%

Companies that ask "Shopping Offers"

If this hits your live OA

Shopping Offers is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The core trick: treat the shopping cart as a bitmask-encoded state rather than iterating all permutations. You map each item count to a unique state identifier, then use dynamic programming with memoization to find the cheapest path through those states. Most candidates waste time either brute-forcing all item subsets (explosion) or trying to greedily apply offers (fails on overlapping discounts). The backtracking piece kicks in when you need to explore which offer to apply first at each state; bitmask compression means you're exploring a bounded state space, not factorial time. Common pitfall: forgetting that offers can unlock other offers, so you can't just apply the obvious discount first. When the obvious greedy play fails in your assessment and you hit the wall, StealthCoder executes the memoized state-transition approach in seconds.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Shopping Offers recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Shopping Offers interview FAQ

How hard is Shopping Offers really compared to other medium problems?+

The acceptance rate is just above 50 percent, making it on the harder end of medium. It's not a straightforward DP problem; the hybrid of bitmask, backtracking, and memo makes it easy to miss the state-space optimization. Most candidates who fail think it's computational explosion, not pattern recognition.

Are MathWorks and Coupang still asking this one?+

Both companies have reported asking Shopping Offers. Given their reported interest, if you're interviewing there, this is a priority to drill. The problem aligns with their systems and optimization needs.

What's the trick I'm missing if greedy doesn't work?+

Greedy fails because applying one offer may block a better multi-offer path later. The trick is memoization over all reachable states, not just obvious moves. Use a bitmask or tuple to encode remaining quantities, then cache the minimum cost to clear from that state.

Do I really need bit manipulation for this, or can I use a dict?+

A dict with tuple keys works fine and is clearer to code. Bit manipulation is an optimization if item counts fit in bits, but it's not mandatory. The real win is memoization over state transitions, not the encoding method.

How does this problem connect to the other topics listed?+

Array is the input. Dynamic Programming plus Memoization is the solution backbone. Backtracking explores which offer to apply next. Bit Manipulation and Bitmask are optional optimizations for state encoding. You only need DP and backtracking to pass.

Want the actual problem statement? View "Shopping Offers" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.