24 Game
A hard-tier problem at 50% community acceptance, tagged with Array, Math, Backtracking. Reported in interviews at Roku and 2 others.
The 24 Game is a tricky problem that hits candidates from Roku, Huawei, and Uber. You're given four numbers and have to figure out if you can combine them with +, -, *, / to make exactly 24. The trap: it's not just about finding one solution. You need to check all possible orderings, groupings, and operator combinations. Half the people who attempt it fail. The problem requires backtracking to explore every valid sequence of operations. If you blank on the state-space search during your live assessment, StealthCoder will surface a working solution in seconds, invisible to the proctor.
Companies that ask "24 Game"
24 Game 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. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderMost candidates start by trying to brute-force all permutations and operator combinations, then wonder why they're missing valid cases. The real challenge is representing the problem correctly: you're not just permuting four numbers into one expression. You're recursively reducing groups of numbers by combining any two of them with any operator, then solving the smaller subproblem. Backtracking is mandatory because you need to try every possible pair-reduction path. Float arithmetic is also a trap: division by zero, rounding errors, and epsilon comparisons for the final equality check will sink you if you're not careful. This is a hard problem because the conceptual leap from permutation-checking to recursive pair-reduction isn't obvious. If this pattern doesn't click during prep and it shows up on your assessment, StealthCoder hedges that gap.
Pattern tags
You know the problem.
Make sure you actually pass it.
24 Game recycles across companies for a reason. It's hard-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. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
24 Game interview FAQ
Is the 24 Game actually asked at big companies?+
Yes. It's confirmed from Roku, Huawei, and Uber. It's a hard-difficulty problem with a 50% pass rate, so it's not a throwaway. Companies like this because it tests both backtracking and careful state management.
What's the trick I'm missing if my brute-force permutation approach isn't working?+
You're likely treating it as a single-pass permutation problem. The trick is recursion: pick any two numbers from your list, combine them with an operator, remove them, add the result back, and recurse on the smaller list. That's how you explore all valid orderings and groupings.
How does this relate to the Backtracking topic?+
Backtracking is the core. You recursively try reducing pairs of numbers, and when a path doesn't lead to 24, you undo and try the next combination. Without backtracking, you miss valid solutions and can't prune invalid branches efficiently.
What are the common pitfalls on implementation?+
Division by zero, integer division truncation, floating-point precision when checking if result equals 24, and forgetting that order matters for subtraction and division. Use epsilon comparison for floats and handle zero checks before dividing.
Is this one of those problems where I need to know the solution beforehand?+
Not if you understand backtracking and recursion well. But if you're weak on either, the pattern won't click fast enough in a live assessment. That's where studying the approach beforehand, or having StealthCoder as a safety net, makes the difference.
Want the actual problem statement? View "24 Game" on LeetCode →