摘要:
If you have solved the N-Queens problem, this one can be solved in a similar manner. Starting from the first row, we try each of its columns. If there... 阅读全文
摘要:
The idea is to use backtracking. In fact, the code below uses DFS, which involves backtracking in a recursive manner.The idea is also very simple. Sta... 阅读全文
摘要:
1 class Solution { 2 public: 3 /* 4 * @param n: An integer 5 * @return: True or false 6 */ 7 bool checkPowerOf2(int n) { 8 ... 阅读全文