N-Queens II Problem
N-Queens II Problem — ExecCode Hard DSA Practice
Solve the N-Queens II problem on ExecCode. Free online hard DSA practice in Backtracking. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Count how many different ways you can place n queens on an n x n chessboard so that no two queens attack each other. You do not need to return the boards, only the count of valid arrangements.
Examples
Input 4; Output 2. Input 1; Output 1. Input 8; Output 92
Constraints
1 <= n <= 14
Practice N-Queens II free on ExecCode. Browse DSA problems, topic map, and placement guides.