← Questions

Fewest moves for a chess piece to capture the king

0
AmazonCodingLast asked Oct 2026

A rectangular board has blocked squares, your piece and the opposing king. Your piece's type decides the directions it may step in, and it can never move onto a blocked square. Return the fewest moves your piece needs to reach the king's square, or report that it cannot.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding