摘要:
题目:Given an integern, return all distinct solutions to then-queens puzzle.Each solution contains a distinct board configuration of then-queens' placement, where'Q'and'.'both indicate a queen and an empty space respectively.思路: 回溯法,首先建立一个备选答案的vector,每次向其中添加一个经过检查可以添加的元素,如果搜索深度达到n则 阅读全文