Yelp SDE Interview Question 2025 April | Backtracking | on-campus

Question · Posted Jun 2026

Question 1: N-Queens II Problem Statement The n-queens puzzle is the famous problem of placing n queens on an n x n chessboard such that absolutely no two queens attack each other. Queens can attack horizontally, vertically, and diagonally across the entire board. Given an integer n, return the total number of distinct mathematical solutions. Constraints 1 <= n <= 9 Examples Example 1: Input: n = 4 Output: 2 Explanation 1: On a 4x4 board, there are exactly two ...

The full answer & interview discussion are available to premium members.

Log in Create a free account