Amazon interview question

Eight queen puzzle