Find Ideal Days
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's Find Ideal Days question hit the assessment circuit in November 2024, and it's a sneaky optimization problem that trips up candidates who don't spot the pattern fast. You're likely dealing with a scheduling or interval-matching scenario where you need to identify which days meet specific criteria. The surface read feels like filtering, but the real work is either greedy selection or dynamic programming. StealthCoder is your safety net if you freeze on the exact algorithm during the live assessment.
Pattern and pitfall
This problem typically boils down to finding a subset of days that maximize some value or satisfy constraints, which means you're either iterating through candidates greedily or building up state with DP. The trap is overthinking the constraint logic before you identify the actual optimization goal. Most candidates waste time on edge cases before they've locked down whether to sort, use a sliding window, or track a running state. The pattern is usually greedy with sorting, or DP if the days have dependencies. Once you see whether you're picking independent days or building a sequence, the code falls into place. StealthCoder reads the problem in real time, so if you blank on whether to sort ascending or descending, or what state to track, it surfaces the pattern immediately.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Find Ideal Days 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Amazon's OA.
Amazon reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Ideal Days FAQ
What's the trick Amazon usually hides in this one?+
The trick is recognizing that you can't just pick any subset. You either need to sort the days by some metric and greedily pick, or build state bottom-up. Read the constraint carefully: are consecutive days forbidden, or does the ideal day depend on previous picks?
Is this a sorting problem or DP?+
Most likely sorting plus greedy. Sort the days by the value metric (or by the day number itself), then iterate and pick greedily based on the constraint. If picks depend on prior picks, it's DP. Test the small examples first to see the pattern.
How do I spot whether days are independent?+
Read the problem statement for words like 'consecutive', 'after', or 'depends'. If there's no ordering constraint between picks, days are independent. If selecting day X blocks day Y, you need DP or a constraint check in your greedy loop.
What's a common wrong first attempt?+
Filtering all valid days and returning them without optimization. The problem asks for 'ideal' days, meaning you must rank or pick a specific subset. Reread the goal: maximize count, minimize span, or pick specific days that satisfy all constraints together.
Can I solve this in 48 hours if I've never seen it?+
Yes. Sketch the greedy approach first. Sort, iterate, check constraints, pick. If it doesn't work on the examples, add DP state. The algorithm is standard. The hard part is reading the constraint correctly, so reread twice before coding.