Baseball Game
A easy-tier problem at 79% community acceptance, tagged with Array, Stack, Simulation. Reported in interviews at Turing and 0 others.
Baseball Game is a straightforward simulation problem that looks deceptively simple on the surface. Turing asks it, and the 78% acceptance rate confirms most people can code it. The trap isn't complexity, it's staying disciplined when your first instinct is to overwrite. You get a list of operations: valid scores, plus rules for doubling the previous score, invalidating the last score, or treating everything that came before as blank. The catch is managing state correctly. If this problem lands in your assessment and you freeze on the invalidation logic, StealthCoder runs invisibly during screen share and hands you a working solution.
Companies that ask "Baseball Game"
Baseball 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. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderThe problem is pure simulation, but the scoring rules create a state-management puzzle. Your instinct will be to track scores in a flat list and modify it in place, which leads to off-by-one errors when you invalidate. The actual pattern is to treat this as a stack problem. Each operation either pushes a new score, doubles the top, or pops. Doubling isn't multiply-and-store, it's double-then-push. The obvious trap is misreading "double" as modifying in place instead of creating a new entry. Similarly, invalidation and blank both mean pop, which confuses people who haven't named those operations clearly. The edge case nobody hits in practice is blank or invalidate on an empty game, which the input constraints prevent. This is why acceptance is high: once you model it as a stack and name your operations precisely, it flows. If you blank during the live assessment, StealthCoder surfaces the stack model instantly.
Pattern tags
You know the problem.
Make sure you actually pass it.
Baseball Game recycles across companies for a reason. It's easy-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 engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Baseball Game interview FAQ
Why is this only easy difficulty if Turing asks it?+
Turing's bar for easy is legitimately easy. Baseball Game has no tricky math, no graph traversal, no greedy proof. It's pure state tracking with clear rules. The 78% acceptance rate reflects that most candidates can code it without heavy algorithmic background. It's a warm-up problem.
What's the stack trick everyone misses?+
Candidates often use an array and mutate it in place for doubling or invalidation, which cascades into confusion. Treat it as a literal stack: push valid scores, double-then-push for 'D', pop for 'C' and '*'. This mental model eliminates index errors and makes the code readable in under 3 minutes.
How does this relate to Array and Simulation topics?+
Array covers the storage layer; Simulation covers the logic layer. You simulate the game rule-by-rule. The data structure chosen (stack vs. array) matters less than modeling each operation correctly. Stack makes it cleaner, array works if you're careful about indices and state.
Is this still asked after LeetCode made it famous?+
Yes. Turing and similar platforms use it because it's practical: it teaches state management without being a slog. It's not so famous that ignoring it is smart. It's common enough that not drilling it is a risk, easy enough that drilling takes 10 minutes.
What happens if the input has 'C' or '*' on an empty game?+
Input constraints prevent it, so don't write defensive code for it. The problem guarantees valid input. If your solution handles empty stack gracefully, that's fine, but it won't be tested. Focus on the happy path and the doubling logic instead.
Want the actual problem statement? View "Baseball Game" on LeetCode →