Discount Events
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's Discount Events question hit the OA circuit in January 2025, and it's a scheduling problem that looks simple on the surface. You're matching discounts to events, probably greedy or interval-based. The trap is thinking too hard about it. The actual solution is straightforward once you see the pattern. StealthCoder will catch the pattern instantly if you freeze on the logic during the live OA.
Pattern and pitfall
This is a greedy or sorting problem. You're likely given events with timestamps and discounts with validity windows, and you need to assign each discount to maximize coverage or count valid matches. The trick is sorting by one dimension (start time, discount expiry, or event deadline) and then greedily picking the best available discount for each event. Most candidates overthink interval overlap and miss that a simple two-pointer or greedy pass works. The pitfall: trying to solve it with a hash table or complex matching when the answer is just sort and iterate. StealthCoder will have the sort-and-iterate pattern locked in, so if you blank during the assessment, you have a fallback for the structure.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Discount Events 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 for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as assign cookies. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Amazon's OA.
Amazon reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Discount Events FAQ
Is this a DP problem or greedy?+
Greedy. Sort your data by one key (usually event time or discount expiry) and iterate through, picking the best available match each time. Greedy works because you're assigning each discount once and moving forward. No overlap recalculation needed.
What's the common mistake Amazon candidates make?+
Overcomplicating interval overlap. Candidates try to check if every discount overlaps with every event. Instead, sort both lists and use a pointer or binary search. The problem becomes linear, not O(n squared). That's the edge.
Do I need to handle ties in sorting?+
Possibly. If two events have the same start time or two discounts expire at the same time, secondary sort by end time or value. Test your sort key with the examples. Usually the problem clarifies which takes priority.
Can I solve this in 48 hours of prep?+
Yes. Study two-pointer merging (like merge intervals) and basic greedy sorting. Practice one interval problem on LeetCode. The Amazon version will be a small twist on that template. Muscle memory beats deep understanding here.
What if discounts can be used multiple times?+
The problem likely specifies. If reusable, it changes to a counting or DP approach. If one-time only, it's greedy matching. Read the constraints carefully. That detail makes or breaks your solution.