Calculate Change
Reported by candidates from PayPay's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
PayPay's June 2025 OA included a coin change problem, and you're staring at it now. Coin change looks simple until you realize you need the minimum number of coins, or the ways to make change, or both. The trick is knowing which variant they're actually asking for. Most candidates freeze because they confuse the greedy approach (which fails on non-standard coin sets) with dynamic programming (which always works). StealthCoder will read the exact problem statement and show you the pattern in seconds if you blank on the recurrence.
Pattern and pitfall
Calculate Change is a classic DP problem. The state is usually dp[amount] = minimum coins needed to make that amount, or ways to make it. The greedy algorithm (always pick the largest coin) fails on inputs like coins=[1,3,4] and amount=6. You need DP: for each coin, update all amounts that can include it. The recurrence is dp[amount] = min(dp[amount], dp[amount-coin]+1) for the min-coin variant, or dp[amount] += dp[amount-coin] for the ways variant. PayPay likely asks for minimum coins or the number of ways. Nail the state definition in your first 30 seconds. If you lose the thread, StealthCoder catches what the problem actually wants and gives you the skeleton.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Calculate Change 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 coin change. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass PayPay's OA.
PayPay 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.
Calculate Change FAQ
Is this the minimum coins or ways to make change?+
Read the problem statement carefully. Minimum coins asks 'fewest coins to make X'. Ways asks 'how many distinct combinations'. They use different DP formulas. If PayPay doesn't specify, assume minimum coins. That's the more common ask.
Can I use a greedy approach?+
Greedy fails on non-standard coin sets. For US coins [1,5,10,25] greedy works. For arbitrary sets like [1,3,4], it fails. Use DP every time unless the problem explicitly says coins are canonical. DP is O(amount * coins) and always correct.
What if amount is 0?+
dp[0] = 0 coins needed (or 1 way, depending on the variant). This is your base case. Initialize it first. Many candidates miss this and crash on zero-amount inputs.
How do I avoid TLE on large amounts?+
Use a 1D DP array, not recursion with memoization. Build bottom-up. O(amount * len(coins)) is fast enough for amount up to 10^4 or 10^5. If amount is huge, the problem likely expects a math trick, not DP.
Should I practice this before the OA?+
If you have time, yes. Coin change is a tier-2 problem and appears often. But the variant matters more than the base problem. Know both min coins and ways to make change. Spend 20 minutes on two variants max.