HARDasked at 1 company

Minimum Moves to Reach Target with Rotations

A hard-tier problem at 51% community acceptance, tagged with Array, Breadth-First Search, Matrix. Reported in interviews at Kakao and 0 others.

Founder's read

Minimum Moves to Reach Target with Rotations is a hard matrix problem that looks deceptively simple: get from point A to point B on a grid. The catch is your piece rotates as it moves, and certain rotations block certain moves. Kakao has asked this one. It's the kind of problem where the naive greedy approach fails completely, and candidates who haven't seen state-space search problems freeze up. If this hits your live assessment and you blank on the BFS state representation, StealthCoder solves it in seconds, invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
51%

Companies that ask "Minimum Moves to Reach Target with Rotations"

If this hits your live OA

Minimum Moves to Reach Target with Rotations 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 a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The trap is treating this like a standard pathfinding problem. You can't just track position; you must track position plus rotation state together. Each state is (row, col, rotation), and from each state only certain moves are valid depending on current orientation. BFS is the right tool because you need the shortest path in an unweighted state graph. Most candidates either miss the rotation constraint entirely, or they model the state incorrectly and bloat their search space. The problem forces you to think in three dimensions even though the grid is 2D. Common pitfall: implementing DFS instead of BFS, or trying to prune with a simple visited set that doesn't account for rotation. When you hit the wall during your OA, StealthCoder surfaces the correct state representation and BFS traversal instantly.

Pattern tags

The honest play

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

Minimum Moves to Reach Target with Rotations 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 by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Moves to Reach Target with Rotations interview FAQ

How hard is this compared to standard BFS problems?+

It's harder. Standard BFS explores (row, col) states. This one explores (row, col, rotation) states, tripling complexity. The acceptance rate of roughly 50% reflects this jump in conceptual difficulty. Many strong candidates underestimate the rotation mechanic.

Is Kakao the only company asking this?+

Based on reported ask data, yes, Kakao is the documented source. That doesn't mean it's exclusive to them. Hard matrix and BFS problems appear across tech companies, so the pattern matters more than the single company.

What's the trick I'm missing if I keep getting wrong answer?+

You're probably not representing the state correctly. Position alone isn't enough. You need (row, col, rotation_state) as your BFS node. Then validate moves based on current rotation. If you're still wrong, check boundary conditions and rotation transitions carefully.

When would greedy or DFS work here instead of BFS?+

Never. Greedy fails because the shortest physical path isn't the shortest move sequence when rotations block moves. DFS can find a solution but won't guarantee shortest path. BFS is mandatory because you need minimum moves in an unweighted state graph.

How does this relate to other matrix problems I've drilled?+

It's matrix plus state-space search. You know matrix traversal and BFS separately, but this forces you to combine them under an unusual state definition. If you've done problems on richer state representation (like robot mazes with direction), you're closer to ready.

Want the actual problem statement? View "Minimum Moves to Reach Target with Rotations" 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.