Practice Maximum Number of Moves to Kill All Pawns
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Number of Moves to Kill All Pawns
Problem Statement
A knight starts at (kx, ky) on a 50 by 50 chessboard, with pawns at the cells listed in positions. Alice and Bob alternate turns, Alice first. On each turn, choose any remaining pawn and move the knight to it along a shortest legal knight path, capturing only that pawn; other pawns crossed on the path remain. The knight then stays at the captured pawn’s cell. A knight move changes one coordinate by two and the other by one. Alice maximizes the total number of moves used to capture every pawn, while Bob minimizes it. Return that total under optimal play.
Source: Maximum Number of Moves to Kill All Pawns on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
kx = 1, ky = 1, positions = [[0,0]]
4
# Example 2
kx = 0, ky = 2, positions = [[1,1],[2,2],[3,3]]
8
# Example 3
kx = 0, ky = 0, positions = [[1,2],[2,4]]
3
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Number of Moves to Kill All Pawns.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.