Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1222. Queens That Can Attack the King
Given positions of multiple black queens and one white king on an 8x8 board, return the queens that can directly attack the king — i.e., the nearest queen (if any) along each of the eight straight or diagonal directions from the king with no pieces in between. This reduces to scanning the eight rays from the king and selecting the first queen encountered in each direction.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.