Toss Strange Coins
A medium-tier problem at 58% community acceptance, tagged with Array, Math, Dynamic Programming. Reported in interviews at Twitch and 0 others.
Toss Strange Coins is a medium-difficulty problem that sits at roughly 58% acceptance, which means it trips up smart people regularly. Twitch has asked it. The twist: you're not dealing with fair coins. Each coin has its own probability of landing heads, and you need to calculate the odds of getting exactly k heads after tossing all of them. The math feels simple until you code it, then it clicks that this is a dynamic programming problem in disguise, not a combinatorics one. If this lands in your live assessment and you blank on the state transition, StealthCoder runs invisibly and surfaces a working solution in seconds.
Companies that ask "Toss Strange Coins"
Toss Strange Coins is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.
Get StealthCoderThe trap is thinking you can pre-calculate probabilities algebraically. You can't scale that way. Instead, you model it as a DP table where each row represents tossing one more coin, and each column represents the current count of heads. For each coin, you update the table: either the coin lands tails and the head-count stays the same, or it lands heads and the count increments. The probability of each outcome comes from multiplying the previous state's probability by the current coin's probability. Array, Math, Dynamic Programming, and Probability and Statistics all collide here. Most candidates freeze because they expect a closed-form formula. The real trick is recognizing that DP over states (coins tossed, heads so far) is the only practical path. Even if the pattern doesn't click in the OA, StealthCoder hedges the gap and lets you move forward.
Pattern tags
You know the problem.
Make sure you actually pass it.
Toss Strange Coins recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Toss Strange Coins interview FAQ
Why is this medium, not easy?+
The 58% acceptance rate confirms it. Early approaches look right but fail on edge cases or use arrays inefficiently. The DP framing isn't obvious at first glance. Most candidates try combinatorics or direct probability math before realizing state-based DP is required. That gap costs time and confidence.
Is this still being asked at real companies?+
Twitch has reported asking it. This flavor of probability DP isn't super common, but it's a fingerprint of companies that care about probabilistic reasoning and state-space modeling. If you hit this in an OA, it's a signal they want to see you think in terms of states and transitions, not formulas.
What's the common mistake?+
Trying to combine probabilities in the wrong order or overwriting DP values before you've finished using them. Another trap: forgetting that each coin's probability is independent, so you multiply, not add. Once you lock in the table shape (coins as rows, head-counts as columns), the logic flows.
How does this relate to other DP problems?+
It's similar to the coin change or knapsack pattern, but instead of maximizing value, you're tracking probability distributions across states. If you've solved DP over subsets or counts, this uses the same mental model. The twist is the probability math, not the DP structure itself.
Do I need to memorize the solution?+
No, but you need to recognize the DP state shape fast. Under OA pressure, knowing 'coins as rows, head-counts as columns' lets you build the table and fill it methodically. Even if you don't have it memorized, that frame gets you to a working solution in 20-30 minutes, assuming no major blocks.
Want the actual problem statement? View "Toss Strange Coins" on LeetCode →