N Queens Problem in Java - Backtracking

N Queens Problem in Java using Backtracking


N Queen problem is of placing N queens on an N×N chessboard so that no two queens attack each other.

Let us first understand what we want to achieve? what is the input and what is the expected output?

You are given a chess board of N * N size, you have to place N Queens on a chess board in such a way that no queens are attacking each other.

Note: Queens attacks on same row, on same column as well as diagonally.

Sample Input and output for 4 * 4 chess board


Burning Rope Puzzle - Measure 45 Minutes

The Burning Rope Puzzle

You have 2 ropes. Each takes exactly 60 minutes to burn. They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. 
In addition, each rope burns inconsistently. How do you measure out exactly 45 minutes?

Both ropes burn at different rate , So how to calculate 45 minutes?

Lets understand the problem statement graphically and it will be more clear,