摘要:
Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文
摘要:
递归:就是出现这种情况的代码: (或者说是用到了栈)解答树角度:在dfs遍历一棵解答树 优点:结构简洁缺点:效率低,可能栈溢出递归的一般结构:1 void f() {2 if(符合边界条件) {3 ///////4 return;5 }6 7 ... 阅读全文
摘要:
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
摘要:
判断valid,没有更好的方法,只能brute force。 1 class Solution { 2 public: 3 bool isValidSudoku(vector > &board) { 4 5 int n; 6 for (int... 阅读全文