考察二叉树的遍历。判断前序遍历,与新增的前->右->左遍历结果是否一致。 C++版 #include <iostream> #include <algorithm> using namespace std; // 定义二叉树 struct TreeNode{ int val; struct Tree ...
分类:
其他好文 时间:
2020-07-26 01:57:55
阅读次数:
63
使用ngx_http_limit_req_module限制用户访问 该模块使用的是漏斗算法来进行限制。 官方的配置示例如下: http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; ... server { ... loca ...
分类:
其他好文 时间:
2020-07-26 01:34:48
阅读次数:
78
题目链接 https://leetcode-cn.com/problems/merge-two-binary-trees/ 题解 递归解法 解法见代码注释 // Problem: LeetCode 617 // URL: https://leetcode-cn.com/problems/merge- ...
分类:
其他好文 时间:
2020-07-26 01:03:49
阅读次数:
54
$ancient_browser 如果浏览器被识别为旧式浏览器,该值等于 ancient_browser_value 的值 $arg_{name} 请求中某个参数值 $args 请求url里的参数 $binary_remote_addr (ngx_http_core_module,ngx_strea ...
分类:
其他好文 时间:
2020-07-26 00:44:12
阅读次数:
114
题目链接 https://leetcode-cn.com/problems/invert-binary-tree/ 题解 递归解法 // Problem: LeetCode 226 // URL: https://leetcode-cn.com/problems/invert-binary-tree ...
分类:
其他好文 时间:
2020-07-26 00:43:25
阅读次数:
55
二分查找(英语:binary search),也叫折半查找(英语:half-interval search),是一种在有序数组中查找特定元素的搜索算法。所以,二分查找的前提是数组必须是有序的。
二分查找只适用顺序存储结构。为保持表的有序性,在顺序结构里插入和删除都必须移动大量的结点。因此,二分查找特... ...
分类:
编程语言 时间:
2020-07-26 00:08:45
阅读次数:
92
链接:https://leetcode-cn.com/problems/convert-sorted-list-to-binary-search-tree/ 代码 /** * Definition for singly-linked list. * struct ListNode { * int v ...
分类:
其他好文 时间:
2020-07-26 00:07:52
阅读次数:
59
链接: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
这个层序遍历要求返回每层的节点,正常的BFS从队列中弹出一个节点后就判断其有没有左子树和右子树,所以直接用BFS实现的话无法分层输出。 需要记录每层的节点数目,增加一个for循环就可以了。 /** * Definition for a binary tree node. * public class ...
分类:
编程语言 时间:
2020-07-25 23:51:28
阅读次数:
72
1.ssh登录 ssh -V 检测是否有ssh程序 ssh root@123.123.123.123 登录相应的机器 文件目录管理命令 tree 命令描述:tree命令用于以树状图列出目录的内容。 tree命令没有内置在系统中,使用tree命令需要执行以下命令来安装: yum install -y ...
分类:
系统相关 时间:
2020-07-25 09:48:24
阅读次数:
95