Mark a Queen’s Attack Board
Updated
Problem statement
Given a square board size and a zero-based queen position, return the board as strings. Use Q for the queen, X for every other cell in the queen’s row, column, or diagonals, and . for an unattacked cell.
Function
markQueenAttacks(size: int, queenRow: int, queenCol: int) → String[]Examples
Example 1
size = 4queenRow = 0queenCol = 0return = ["QXXX","XX..","X.X.","X..X"]Example 2
size = 3queenRow = 1queenCol = 1return = ["XXX","XQX","XXX"]Constraints
1 <= size <= 200.0 <= queenRow, queenCol < size.
More Motive Phone Screen questions
- Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Search in Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
- Pair Left and Right Shoes by SizePHONE SCREEN · Seen Jun 2025
- Lowest Common Ancestor in a Binary TreePHONE SCREEN · Seen Apr 2025
- Count Product-Divisible PairsPHONE SCREEN · Seen Sep 2024
- Resolve Variable Equations with Dependency ErrorsPHONE SCREEN · Seen Jun 2024
- Average Values by Binary-Tree LevelPHONE SCREEN · Seen May 2024
- Chunked Round-Robin Row TraversalPHONE SCREEN · Seen May 2024
Similar questions at other companies
- Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
- Trace an Eight-Direction Robot Until BlockedPinterest · PHONE SCREENPinterest interview questions
- Excel Training Data and Model Response AuditMicrosoft · PHONE SCREENMicrosoft interview questions
- Count Connect-Four Scoring LinesBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Spiral Order with ObstaclesTemu · PHONE SCREENTemu interview questions
- Incremental Hard Attention with a KV CacheOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Spiral Matrix TraversalByteDance · PHONE SCREENByteDance interview questions
- S-Shaped Matrix TraversalFox Corporation · PHONE SCREEN
- Zigzag Board Adjacent SwapsUber · PHONE SCREENUber interview questions
- Longest Consecutive Same-Color LineGoogle · PHONE SCREENGoogle interview questions