码迷,mamicode.com
首页 >  
搜索关键字:easyui treegrid treenode    ( 5856个结果
1530. 好叶子节点对的数量
class Solution { public int countPairs(TreeNode root, int distance) { dfs(root,0,distance); return res; } private int res = 0; public List<Integer> df ...
分类:其他好文   时间:2020-07-27 13:50:30    阅读次数:114
leetcode-----111. 二叉树的最小深度
链接:https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNod ...
分类:其他好文   时间:2020-07-26 19:03:29    阅读次数:62
leetcode-----112. 路径总和
链接:https://leetcode-cn.com/problems/path-sum/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode ...
分类:其他好文   时间:2020-07-26 19:00:19    阅读次数:52
力扣-94-二叉树的中序遍历
题目:传送门 方法一、递归 中序遍历:先遍历左子树,在遍历根节点,最后遍历右子树。比较经典的方法是递归。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeN ...
分类:其他好文   时间:2020-07-26 15:32:51    阅读次数:67
面试题28:对称的二叉树
考察二叉树的遍历。判断前序遍历,与新增的前->右->左遍历结果是否一致。 C++版 #include <iostream> #include <algorithm> using namespace std; // 定义二叉树 struct TreeNode{ int val; struct Tree ...
分类:其他好文   时间:2020-07-26 01:57:55    阅读次数:63
面试题26:树的子结构
考察二叉树的遍历。 C++版 #include <iostream> #include <algorithm> using namespace std; // 定义二叉树 struct TreeNode{ int val; struct TreeNode* left; struct TreeNode ...
分类:其他好文   时间:2020-07-26 01:18:59    阅读次数:54
leetcode-----110. 平衡二叉树
链接:https://leetcode-cn.com/problems/balanced-binary-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; ...
分类:其他好文   时间:2020-07-26 00:05:02    阅读次数:58
1261. 在受污染的二叉树中查找元素
给出一个满足下述规则的二叉树: root.val == 0如果 treeNode.val == x 且 treeNode.left != null,那么 treeNode.left.val == 2 * x + 1如果 treeNode.val == x 且 treeNode.right != nu ...
分类:其他好文   时间:2020-07-25 11:44:04    阅读次数:102
二叉树中和为某一值的路径
解题:前序遍历加上筛选 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = ...
分类:其他好文   时间:2020-07-23 23:27:44    阅读次数:132
按层打印二叉树
题目描述 从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。 输出: 二维列表:[[1,2],[4,5]] 思路: 使用两个列表分别存放当前层节点,下一层节点 1 # -*- coding:utf-8 -*- 2 # class TreeNode: 3 # def __init__(s ...
分类:其他好文   时间:2020-07-23 23:21:46    阅读次数:78
5856条   上一页 1 ... 10 11 12 13 14 ... 586 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!