Reported January 2025
Amazongreedy

Get Max Events

Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Amazon OA. Under 2s to a working solution.
Founder's read

Amazon's Get Max Events question landed in January 2025 OAs, and it's a greedy scheduling problem disguised as a calendar puzzle. You're given events with start and end days, and you need to maximize how many you can attend. The trap is assuming you should sort by end time and pick greedily. That works, but the real trick is realizing you can attend multiple events on the same day, and the constraint is stricter than it looks. This is the kind of problem where a small detail shift breaks your first solution. StealthCoder runs invisibly during your OA to catch you if you misread the constraint.

Pattern and pitfall

The canonical approach is greedy interval scheduling: sort events by end day, then iterate through and pick events that don't conflict. But Get Max Events has a twist: you can only attend one event per day, and some events span multiple days. So the greedy choice is to pick the event ending soonest, mark those days as used, and move on. The pitfall is tracking which days you've used or miscounting overlaps. Common mistakes include sorting by start time instead of end time, or thinking you can attend all events on the same day. The algorithm is O(n log n) for sorting, then O(n*d) where d is the range of days. If you blank on the greedy property during the OA, StealthCoder will confirm the sort order and the day-tracking logic in real time.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Get Max 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as maximum number of events that can be attended. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Amazon's OA.

Amazon reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Max Events FAQ

Can I attend two events on the same day?+

No. The constraint is one event per calendar day. If an event spans days 1-3, you pick one of those three days to attend. That's why greedy by end day is optimal: you finish events sooner and free up later days.

Does it matter if I sort by start or end time?+

Yes, it matters a lot. Sorting by end day is correct. Sorting by start day will give you a suboptimal count. End time greedy always beats start time greedy for interval scheduling.

What's the trick Amazon is testing here?+

Recognizing that one-event-per-day constraint forces a greedy strategy, and that greedy is provably optimal. Many candidates overthink it or miss the one-per-day rule and assume they can pack events freely.

How should I track which days I've used?+

A set or a boolean array works. Since day ranges can be large, a set is cleaner. For each event you pick, iterate from its end day backward and mark the first free day you find.

Is this still being asked at Amazon in 2025?+

Yes, this style of greedy scheduling is a recurring Amazon OA pattern. The variant shifts each cycle, but the core logic stays the same. Getting the greedy order right is the bar.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Amazon.

OA at Amazon?
Invisible during screen share
Get it