Practice Problem

N-Queens II

Difficulty: Hard

Given an integer n, return the number of distinct solutions to the n-queens puzzle, where n queens are placed on an n x n chessboard so that no two queens attack each other.