/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ ...
分类:
其他好文 时间:
2020-07-15 23:31:48
阅读次数:
66
public boolean isBalanced(TreeNode root) { if (root == null) { return true; } int diff = getDepth(root.left) - getDepth(root.right); diff = diff > 0 ? ...
分类:
其他好文 时间:
2020-07-15 22:51:05
阅读次数:
53
datebox限制时间选择 对datebox可选择日期进行限制,目前感觉使用起来效果很好,不可选择的日期置灰不可点击 1. 限制开始时间小于结束时间 //using limitStartDateAndEndDate($("#DateStart"), $("#DateEnd")); /** * 限制开 ...
分类:
其他好文 时间:
2020-07-14 18:36:28
阅读次数:
123
class Solution { public int longestConsecutive(TreeNode root) { dfs(root); return res; } private int res = 0; public int[] dfs(TreeNode root) { // 以ro ...
分类:
其他好文 时间:
2020-07-14 18:25:06
阅读次数:
49
class Solution { public int maxPathSum(TreeNode root) { dfs(root); return res; } int res = Integer.MIN_VALUE; public int dfs(TreeNode root) { // 返回以当前 ...
分类:
其他好文 时间:
2020-07-14 18:15:42
阅读次数:
58
BFS广度遍历代码模板 /** 广度遍历代码模板 */ public class TestBFS { public List<List<Integer>> bsf(TreeNode root) { // 如果节点为空 if (root == null) { return null; } List<L ...
分类:
其他好文 时间:
2020-07-13 18:26:06
阅读次数:
70
题目链接 https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ 题解一:递归 // Problem: LeetCode 94 // URL: https://leetcode-cn.com/problems/binary-tr ...
分类:
其他好文 时间:
2020-07-13 15:36:49
阅读次数:
58
var tab = $('#maintabs').tabs('getSelected'); //获得当前选中的tab 的href var url = $(tab.panel('options')).attr('href'); tab.panel('refresh', url); ...
分类:
其他好文 时间:
2020-07-13 11:27:12
阅读次数:
57
题目链接 https://leetcode-cn.com/problems/binary-tree-preorder-traversal/description/ 题解一:递归 // Problem: LeetCode 144 // URL: https://leetcode-cn.com/prob ...
分类:
其他好文 时间:
2020-07-13 00:00:50
阅读次数:
90
BFS和DFS DFS遍历使用递归(隐式使用栈): void dfs(TreeNode root) { if (root == null) { return; } dfs(root.left); dfs(root.right); } BFS遍历使用队列 void bfs(TreeNode root) ...
分类:
其他好文 时间:
2020-07-12 22:04:02
阅读次数:
66