MEDIUMasked at 2 companies

Knight Probability in Chessboard

A medium-tier problem at 57% community acceptance, tagged with Dynamic Programming. Reported in interviews at Citadel and 1 others.

Founder's read

You're on a chessboard with a knight. After exactly K moves, what's the probability it stays on the board. Citadel and Goldman Sachs ask this one. The trap is obvious: brute-force every path. Most candidates bomb the first attempt because they either don't memoize or they track state wrong. The acceptance rate sits just under 57 percent, meaning half the people who see this live blank on the memo structure. If this problem hits your online assessment and you freeze on how to set up the DP state, StealthCoder solves it in seconds while you're screen-sharing.

Companies asking
2
Difficulty
MEDIUM
Acceptance
57%

Companies that ask "Knight Probability in Chessboard"

If this hits your live OA

Knight Probability in Chessboard 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 by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trick is dynamic programming with state (row, col, remaining_moves). You track how many ways a knight can reach each board position with exactly K moves left. The knight has up to 8 possible moves from any square, but most land off the board. You build the DP table bottom-up or top-down, ensuring you don't count paths that exit early. The common mistake is computing all paths without filtering invalid squares, or mixing up whether you're counting paths that stay on the board versus paths that leave and come back. Once you lock in the state definition and iterate through move counts correctly, the solution falls out fast. This is where StealthCoder runs invisibly during your assessment: read the board constraints, set up memo correctly, and deliver the answer before the proctor suspects you needed help.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Knight Probability in Chessboard 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Knight Probability in Chessboard interview FAQ

Is this really a medium or does it feel harder?+

It reads medium. The core logic is straightforward if you've done grid DP before. The hard part is not panicking when you realize every knight move has to be checked for board boundaries. Once you accept that filtering is built into the DP update, it unblocks fast. Acceptance rate of 57 percent reflects people getting nervous, not algorithm complexity.

What's the key insight so I don't blank on it live?+

State is (row, col, moves_remaining). You compute how many ways to reach each square after exactly M moves. Then multiply by the valid paths at each position and divide by total paths. It's not about one knight's path, it's about counting all possible paths and filtering for the ones that stay on board the whole time.

How does this relate to the Dynamic Programming topic?+

It's a textbook grid-based DP problem. You're breaking down the problem into subproblems: how many paths of length K land at each square without leaving the board. Memoization prevents recalculating the same (row, col, remaining_moves) state multiple times. Without DP, you'd timeout on even modest board and move counts.

Do Citadel and Goldman Sachs actually ask this or is it noise?+

Both have reportedly asked it. It's not their most common ask, but it does come up in their coding rounds. If you're prepping for either of them, knowing the DP state pattern and how to filter off-board moves gives you a concrete edge in the live assessment.

What's the biggest pitfall I should avoid?+

Not defining your state clearly before coding. Some candidates try to track knight position and move count but forget to count total paths, or they count invalid paths that escape the board. Write out your DP definition first: rows, cols, move number, what you're summing. That thirty-second clarity saves ten minutes of debug.

Want the actual problem statement? View "Knight Probability in Chessboard" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.