先挖坑,过几天填 https://www.luogu.com.cn/training/14535#problems 可持久化数组 P3919 【模板】可持久化线段树 1(可持久化数组) #include<bits/stdc++.h> using namespace std; const int ma ...
分类:
其他好文 时间:
2020-07-23 23:30:13
阅读次数:
112
解题:前序遍历加上筛选 /** * 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、两个节点在根的右侧 3、两个节点在根的左右两侧 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * ...
分类:
其他好文 时间:
2020-07-23 22:15:14
阅读次数:
77
二叉树重建 问题:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重 复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。 解决: #递归一 # class Tree ...
分类:
其他好文 时间:
2020-07-23 16:17:32
阅读次数:
71
根据BST的前序遍历重建BST 1. 平均O(NlogN) 最坏O(N^2) class Solution { public: TreeNode* dfs(int l, int r, vector<int>& p) { if (l > r) return nullptr; TreeNode* nod ...
分类:
其他好文 时间:
2020-07-23 16:13:09
阅读次数:
67
实用命令-tree 平时在写博客的时候,有时会说到项目,需要将自己的项目结构导出来,这时我们 需要用到一下命令: tree >> /路径/tree.txt 第一次执行的时候会报错 -bash: tree: command not found 说明,你的电脑环境下是没有,这个命令的,所以你需要安装, ...
分类:
其他好文 时间:
2020-07-23 01:51:56
阅读次数:
96
运行designer.exe文件保错 This application failed to start because it could not find or load the Qt platform plugin "windows"in “”, Available platform plugin ...
分类:
移动开发 时间:
2020-07-22 20:13:55
阅读次数:
271
题意: 给你n个节点,这n个节点构成了一颗以1为树根的树。每一个节点有一个初始值bi,从任意节点 i 的子树中选择任意k个节点,并按他的意愿随机排列这些节点中的数字,从而产生k?ai 的成本。对于一个节点i你需要将bi改成ci。 这个bi值和ci值的范围是[0,1] 题解: 对于一个节点,如果它的b ...
分类:
其他好文 时间:
2020-07-22 16:14:04
阅读次数:
63
function renderList(data){ var str = ''; for(var i = 0; i < data.length; i++){ // 动态添加li str += '<li onclick="getFile(\''+ data[i].file_id + '\',\'' + ...
分类:
Web程序 时间:
2020-07-22 11:33:50
阅读次数:
109
问题描述 翻转一棵二叉树。 示例: 输入: 4 / \ 2 7 / \ / \1 3 6 9输出: 4 / \ 7 2 / \ / \9 6 3 1备注:这个问题是受到 Max Howell 的 原问题 启发的 : 谷歌:我们90%的工程师使用您编写的软件(Homebrew),但是您却无法在面试时在 ...
分类:
其他好文 时间:
2020-07-22 01:36:38
阅读次数:
78