Reported November 2024
Amazonsimulation

Rooks Left

Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Amazon OA. Under 2s to a working solution.
Founder's read

Amazon asked this in November 2024, and it's a board manipulation problem that looks simpler than it is. You've got rooks on a chessboard, and you need to figure out how many are left after some operation. The trick is recognizing whether this is about collision logic, reachability, or just counting what survives a rule. Most candidates overthink the board representation when the real work is understanding what "left" means in context. StealthCoder will catch the pattern if you blank on the board state logic.

Pattern and pitfall

Rooks Left is typically a simulation or graph-reachability problem disguised as a chess puzzle. The common approach: model the board state, understand the attack or removal rules (usually rooks eliminate each other based on line-of-sight), then count survivors. The pitfall is misreading the rule for what causes a rook to be "left." Some versions ask you to simulate rook attacks in order; others ask for the final stable state. The trick is often that you need to process removals in a specific order or recognize that certain rooks will never be threatened. If you hit this live and freeze, StealthCoder will reconstruct the board logic and walk through the removal sequence.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Rooks Left 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Amazon's OA.

Amazon reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Rooks Left FAQ

Is this a pure simulation or do I need to optimize?+

Start with simulation. Model the board, apply the rules, count what remains. If the board is small (8x8 or similar), brute force works. Only optimize if you get TLE. Usually Amazon's version runs clean in O(n*m) or O(n^2) depending on rook count.

How do I know if rooks attack each other or if there's a removal order?+

The problem statement will specify. If it doesn't, assume rooks on the same row or column attack each other, and process removals either in placement order or all-simultaneous. Test both interpretations on the sample input first.

What's the trick Amazon is testing here?+

It's not algorithmic complexity. Amazon is checking your ability to parse an unclear rule, model state accurately, and trace through logic without mistakes. Board problems reward clean code and careful indexing.

Can I solve this in 2D arrays or do I need a smarter structure?+

2D arrays work fine. You might also track rooks as a list of (row, col) tuples and check conflicts by scanning rows and columns. Either approach is valid. Pick whichever you code faster.

What if I can't remember the exact rule during the OA?+

Read the problem twice. If it's still unclear, ask for clarification in the chat. If you blank mid-solution, reconstruct from the examples. Most OA problems are solvable by working backward from test cases.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Amazon.

OA at Amazon?
Invisible during screen share
Get it