DiffPush Tier Recursion · Try Out All Combos O(n!) upper bound — column-by-column placement with diagonal pruning · O(n^2) to store each board plus O(n) recursion depth
A security grid places n patrol drones so that no two share a column, a row, or any diagonal — one drone per file, and no clear line of sight along a slope. The dispatcher fills the grid one column at a time, trying each row in the current column, and keeps three occupancy ledgers: rows taken, diagonals sloping one way, and diagonals sloping the other. When all n columns hold a drone, the layout is archived.
Input: An integer n, the grid size and drone count.
Output: Every distinct layout as n row-strings, each 'Q' marking a drone and '.' an empty cell.
1 <= n <= 9Input: {"n":4}
Output: [[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
The 4-grid has exactly two distinct layouts, mirror images of each other.
Input: {"n":1}
Output: [["Q"]]
A single drone is trivially safe.