题目描述 https://leetcode-cn.com/problems/subtree-of-another-tree/ 题解 我写的 两层DFS、双重DFS 其它题解一般也是这个思路 // Problem: LeetCode 572 // URL: https://leetcode-cn.co ...
分类:
其他好文 时间:
2020-07-26 19:01:52
阅读次数:
62
链接: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
效果图如下: 参考GitHub来实现的,更详细的源码以及参数说明见:GitHub 本篇文章的html源码: <!DOCTYPE html> <html> <head> <title>openlayers6结合echarts4实现迁徙图</title> <link rel="stylesheet" h ...
分类:
其他好文 时间:
2020-07-26 15:58:57
阅读次数:
124
「APIO2018」选圆圈(K-D Tree/CDQ+Set) Part1 K-D Tree做法 K-D Tree经常用来优化大暴力。。 把圆$(x,y,r)\(视为矩形\)(x-r,y-r,x+r,y+r)\(,依据\)(x,y)$构建K-D Tree 维护K-D Tree每个节点所有矩形最小和最 ...
题目链接: P2633 Count on a tree solution: LCA好题.询问第k大,不难想到主席树和前缀和思想,对于每个点$x$,我们可以用主席树维护root到$x$上的序列,然后查询$x,y$路径上的第$k$小只需要用前缀和维护权值线段树,用$x+y-lca(x,y)-f[lca( ...
分类:
其他好文 时间:
2020-07-26 15:45:20
阅读次数:
73
题目:传送门 方法一、递归 中序遍历:先遍历左子树,在遍历根节点,最后遍历右子树。比较经典的方法是递归。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeN ...
分类:
其他好文 时间:
2020-07-26 15:32:51
阅读次数:
67
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between ...
分类:
其他好文 时间:
2020-07-26 02:05:42
阅读次数:
102
考察二叉树的遍历。判断前序遍历,与新增的前->右->左遍历结果是否一致。 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