``` #include #include #include #include using namespace std; #define int long long const int N=4e6+10; int e[N],ne[N],h[N],idx; int depth[N]; int ans[... ...
分类:
其他好文 时间:
2020-04-27 21:00:16
阅读次数:
52
题意描述 从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。 解题思路 一、递归 使用 depth 表示当前打印的层数。 1. 当前节点为空,返回。 2. 当前层数 》 已打印的层数,扩容。 3. 将元素添加入集合。 4. 向左递归、向右递归。 二、非递归 利用队列先进先出的特点。 1 ...
分类:
其他好文 时间:
2020-04-27 17:22:03
阅读次数:
54
NPM是随同NodeJS一起安装的包管理工具,能解决NodeJS代码部署上的很多问题 // 检查是否安装成功 npm -v // 升级npm npm install npm -g // 查看本地全局依赖包 npm list -g --depth 0 // 我的全局依赖包 +-- cnpm@6.1.1 ...
分类:
其他好文 时间:
2020-04-26 15:24:21
阅读次数:
54
参考:https://blog.csdn.net/qq_38664371/article/details/80352102 https://blog.csdn.net/weixin_30553065/article/details/96045980?depth_1-utm_source=distri ...
分类:
其他好文 时间:
2020-04-26 01:17:35
阅读次数:
63
1. 构造: 2~4. 和第一题的解法都一样,看不出有什么变化 这里看了下其实绕过的方法挺多的:https://blog.csdn.net/qq_41617034/article/details/105249339?depth_1-utm_source=distribute.pc_relevant. ...
分类:
Web程序 时间:
2020-04-25 12:50:30
阅读次数:
252
https://blog.csdn.net/weixin_34253126/article/details/93354564?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&utm_sou ...
分类:
数据库 时间:
2020-04-21 15:03:17
阅读次数:
93
理解参照 网站 https://blog.csdn.net/li528405176/article/details/86615003 代码参考网址 https://blog.csdn.net/feierxiaoyezi/article/details/79998060?depth_1-utm_sou ...
分类:
编程语言 时间:
2020-04-21 11:19:07
阅读次数:
64
# 统计字典或者json字符串的深度 def depth(x): if type(x) is dict and x: return 1 + max(depth(x[a]) for a in x) if type(x) is list and x: return 1 + max(depth(a) fo ...
分类:
Web程序 时间:
2020-04-19 17:43:11
阅读次数:
93
以前自学数据结构和算法的时候,回溯算法一直没涉及到,当时只听过,也没用过,这两天看到一个数独问题的博客,看下来居然一脸懵逼,这肯定是不能接受的,所以一鼓作气把回溯算法好好品了品,赶紧记下来,巩固一下。 回溯算法,简单来说,其实就是对解空间的一种深度优先搜索(DFS:Depth-First-Searc ...
分类:
编程语言 时间:
2020-04-19 01:04:55
阅读次数:
73
import java.util.* class Solution { fun minDepth(root: TreeNode?): Int { if (root == null) { return 0 } var depth = 0 //LinkedList实现了Queue接口,可以用作队列使用 ...
分类:
其他好文 时间:
2020-04-16 15:12:48
阅读次数:
56