Planning the Campaign
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's Planning the Campaign problem hit the October assessments hard, and candidates are blanking on the approach. You've got a logistics or optimization puzzle in front of you, likely with constraints that make brute force fail fast. The trick isn't always obvious on first read. StealthCoder sits invisible on your screen during the OA, reads the problem, and feeds you the pattern and solution in real time. If you freeze mid-assessment, you have a safety net.
Pattern and pitfall
Without the full problem text, the pattern likely involves greedy choice, dynamic programming, or mathematical optimization. Campaign planning usually means resource allocation, scheduling, or cost minimization under constraints. The common pitfall is solving locally optimal at each step and missing the global structure. Candidates often code a naive simulation, hit time limits, then panic. The real solution usually involves sorting by some metric (cost, impact, deadline) and then either greedy selection or a DP recurrence. Amazon loves problems that look like they need simulation but actually yield to a clean algorithmic insight. When you're live and stuck, StealthCoder can surface the pattern and push you past the mental block.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Planning the Campaign 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.
Planning the Campaign FAQ
Is this a greedy problem or dynamic programming?+
Usually greedy. Sort by a key metric (cost per impact, deadline, or roi), then make locally optimal choices that build the global solution. Test your sort order against the examples. If greedy fails, then consider DP with memoization on remaining budget or campaigns.
What's the most common pitfall candidates hit?+
Simulating every possible campaign order or subset. That's exponential and times out. The trick is finding the right sort order or recurrence relation so you can avoid the combinatorial explosion. Read the constraints carefully.
How do I approach this in under 10 minutes on the OA?+
Skim the problem for the objective (maximize revenue, minimize cost, hit a deadline). Identify constraints. Sketch a greedy sort order based on the metric that seems to matter most. Code that first. If examples fail, switch to DP. Don't overthink.
Are there edge cases I should watch for?+
Empty input, single campaign, all campaigns exceeding budget, ties in the sort metric. Also watch for integer overflow if you're summing large budgets or impacts. Test boundary cases before submitting.
Is this problem still being asked at Amazon in late 2024?+
Yes. October 2024 reports confirm it. Expect similar resource allocation or scheduling variants. The algorithm doesn't change, but the story flavor might. Study the greedy and DP patterns, not just this one version.