Goldman Sachs Interview Question

N queen problem