Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] ...
分类:
其他好文 时间:
2020-05-25 10:54:39
阅读次数:
51
很简单,来个层次遍历,当遍历队列,遍历到刚开始遍历时,队列里最后一个数时(也就是遍历len-1次),得到的就是右视图的其中一个节点 /** * Definition for a binary tree node. * public class TreeNode { * int val; * Tree ...
分类:
其他好文 时间:
2020-05-25 09:46:16
阅读次数:
49
一、STP(生成树协议) 运行在交换机上防止交换机换路的技术 为了提高网络可靠性,交换网络中通常会使用冗余链路。然而,冗余链路会给交换网络带来环路风险,并导致广播风暴以及MAC地址表不稳定等问题,进而会影响到用户的通信质量。生成树协议STP(Spanning Tree Protocol)可以在提高可 ...
分类:
其他好文 时间:
2020-05-25 00:05:24
阅读次数:
88
题目: 路径总和 II:给定一个二叉树和一个目标和,找到所有从根节点到叶子节点路径总和等于给定目标和的路径。 说明: 叶子节点是指没有子节点的节点。 示例:给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1返回: [ [5, ...
分类:
编程语言 时间:
2020-05-24 21:00:42
阅读次数:
109
翻转一棵二叉树。 示例: 输入: 4/ \2 7/ \ / \1 3 6 9输出: 4/ \7 2/ \ / \9 6 3 1 python # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): ...
分类:
其他好文 时间:
2020-05-24 13:56:30
阅读次数:
47
地址 https://leetcode-cn.com/contest/weekly-contest-190/problems/pseudo-palindromic-paths-in-a-binary-tree/ 题目描述给你一棵二叉树,每个节点的值为 1 到 9 。我们称二叉树中的一条路径是 「伪回 ...
分类:
其他好文 时间:
2020-05-24 13:51:05
阅读次数:
73
# 树的单个结点 class Node: def __init__(self,elem): # 结点数据 self.elem = elem # 左子树和右子树 self.lchild = None self.rchild = None # 二叉树的实现 class my_tree: # 初始化空树 ...
分类:
其他好文 时间:
2020-05-24 13:46:26
阅读次数:
51
前言 100道MySQL数据库经典面试题解析,已经上传github啦 https://github.com/whx123/JavaHome/tree/master/Java%E9%9D%A2%E8%AF%95%E9%A2%98%E9%9B%86%E7%BB%93%E5%8F%B7 公众号:捡田螺的小 ...
分类:
数据库 时间:
2020-05-24 13:44:05
阅读次数:
99
$$\text{Link(Renko, Merry);}$$
$$\text{Cut(Renko, Merry);}$$
$$\color{red}{\text{Runtime Error!}}$$ ...
分类:
其他好文 时间:
2020-05-24 12:08:05
阅读次数:
51
import java.util.HashMap;import java.util.LinkedList;import java.util.Queue;/** * 二叉树最大宽度 */public class TreeMaxWidth { /** * 不使用HashMap实现 * * @param ...
分类:
其他好文 时间:
2020-05-24 11:52:46
阅读次数:
54