You are given an 8 × 8 chessboard with:
• Multiple black queens ('Q')
• One white king ('K')
You are given:
• queens[i] = [xQueeni, yQueeni] → position of the i-th black queen
• king = [xKing, yKing] → position of the white king
Return all the queens that can directly attack the king —
that is, queens that are the first piece seen in any of the 8 possible directions (vertical, horizontal, or diagonal).
You may return the result in any order.
Input: queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]] king = [0,0]
Output: [[0,1],[1,0],[3,3]]
Input: queens = [[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]] king = [3,3]
Output: [[2,2],[3,4],[4,4]]
Accepted:
Submission: