![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
球大昕
这个人很懒...什么都没有留下
展开
-
leetcode深搜专题_100
这道题是一道简单题,但对于我来说从这道题得到的收获还是蛮多的递归 只需要考虑当前p q是否都为空 或者是否都相同 之后重复调用即可 public boolean isSameTree(TreeNode p,TreeNode q){ if( p == null && q == null) return true; if(p !=null &...原创 2019-06-12 20:44:32 · 112 阅读 · 0 评论 -
leetcode_51_N皇后
这道题目 public List<List<String>> solveNQueens(int n) { List<List<String>> res = new ArrayList<>(); if(n <=0) return res; helper(res,...原创 2019-06-11 14:26:07 · 120 阅读 · 0 评论 -
leetcode_52_N皇后2
public class NquenesII { int res = 0; /** [".Q..", [0行,1列] "..Q.", [1行,2列] "..Q.", ".Q.."], * * * */ public int totalNQueens(int...原创 2019-06-11 14:49:06 · 92 阅读 · 0 评论 -
算法题
有一个公式: [a,b] * (a,b) = a,b[a,b] : a b的最小公倍数(a,b): a b 的最大公约数public class Main{static int gcb(int a,int b){ return b != 0 ? gcb(b,a%b) : a; } public static void main(...原创 2019-06-11 15:25:37 · 94 阅读 · 0 评论 -
leetcode深搜专题
// 二叉树的中序非递归遍历 public static void medOrderUnRecur(Node root) { if (root == null) { return; } Stack<Node> stack = new Stack<>(); while (!stack....原创 2019-06-11 21:56:59 · 186 阅读 · 0 评论