Find Min Price to Spend
Reported by candidates from Paypal's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
PayPal hit you with a pricing optimization question in October 2024, and you've got 24 hours to figure out the trick. This is a greedy or dynamic programming play, depending on how the input is structured. You're looking at a spending problem where you need to find the minimum cost to reach a goal, which almost always means either sorting and picking the cheapest options in order, or building up a DP table of subproblems. StealthCoder will read the exact constraints and prompt you toward the pattern in real time during the OA.
Pattern and pitfall
The core pattern here is likely greedy with a twist, or a small DP problem disguised as a pricing question. If it's greedy, you sort all available price points and pick the minimum combination that satisfies the constraint. If it's DP, you're computing the minimum cost at each spending level, with transitions defined by available offers or bulk discounts. The pitfall is assuming a single cheap option works; PayPal typically layers conditions like "spend X to unlock discount Y" or "choose K items from N options." You need to either enumerate all combinations (small N) or use DP to avoid redundant work. StealthCoder will highlight which approach fits the input, so you don't waste OA time on the wrong direction.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Find Min Price to Spend 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 would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as coin change. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Paypal's OA.
Paypal reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Min Price to Spend FAQ
Is this a math problem or a search problem?+
It's a combinatorial optimization problem framed as pricing. You're not doing calculus; you're finding the minimum-cost subset or sequence of choices that meets a spending target or discount threshold. Math intuition helps, but algorithm selection (greedy vs. DP) is what matters.
What's the most common trap?+
Assuming the single cheapest item is the answer. PayPal-style problems layer constraints: discounts only apply if you spend above a threshold, or you must buy in bundles. Always read the full constraint list before coding.
How do I prepare in 48 hours?+
Know the difference between greedy (sort and pick) and DP (build up from zero). Solve one LeetCode coin change or minimum cost problem. Understand when greedy fails. Don't memorize; understand the template.
Will there be multiple test cases with different constraints?+
Almost certainly. PayPal tests edge cases: empty input, single item, no valid solution, exact match, and overshooting. Code defensively and trace through each by hand before submitting.
Is this still being asked in 2024?+
Yes. Pricing and cost optimization are core to fintech. PayPal asks this pattern regularly. It's not trendy; it's fundamental to their domain.