N Queens Problem Algorithm