BackhardDesign

Optimal Placement of Dominant Entities Solution

Problem Statement

Determine all configurations to position N dominant entities on an NxN grid such that no entity attacks another.

Example 1
Input
n = 4
Output
[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]

Explanation: The output configurations represent 4x4 grid placements where 4 entities are positioned such that none attack each other.

Constraints

  • 1 <= n <= 10
  • The grid is a square with side length n
  • Each entity can attack horizontally, vertically, or diagonally
  • The number of entities is equal to n
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free