NeetCode #518LC-51HardBacktrackingNC 150NC 250
← Back to All Problems

#518 · #51 · N-Queens(N 皇后)

📌 Problem Statement & Constraints

The n-queens puzzle places n queens on an n x n board so that no two attack each other. Given n, return all distinct solutions, each as a list of strings. Constraints: 1 <= n <= 9.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!