1222. Queens That Can Attack the King

https://leetcode.com/problems/queens-that-can-attack-the-king

Description

On an 8x8 chessboard, there can be multiple Black Queens and one White King.

Given an array of integer coordinates queens that represents the positions of the Black Queens, and a pair of coordinates king that represent the position of the White King, return the coordinates of all the queens (in any order) that can attack the King.

Example 1:

Example 2:

Example 3:

Constraints:

  • 1 <= queens.length <= 63

  • queens[i].length == 2

  • 0 <= queens[i][j] < 8

  • king.length == 2

  • 0 <= king[0], king[1] < 8

  • At most one piece is allowed in a cell.

ac

Last updated

Was this helpful?