摘要: 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... 阅读全文
posted @ 2015-07-01 22:28 jianchao-li 阅读(228) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-07-01 21:16 jianchao-li 阅读(258) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 /* 4 * @param n: An integer 5 * @return: True or false 6 */ 7 bool checkPowerOf2(int n) { 8 ... 阅读全文
posted @ 2015-07-01 01:59 jianchao-li 阅读(428) 评论(0) 推荐(0)