问题: 给定一个int数组A,数组中元素互不重复,给定一个数x,求所有求和能得到x的数字组合,组合中的元素来自A,可重复使用。 #include<iostream> #include<vector> #include<algorithm> using namespace std; void getS ...
分类:
其他好文 时间:
2020-07-26 01:53:45
阅读次数:
111
vector c++的vector的使用方法,创建,初始化,插入,删除等。 #include "ex_vector.h" #include <iostream> #include <vector> #include <string> using namespace std; void ex_vect ...
分类:
编程语言 时间:
2020-07-26 01:46:42
阅读次数:
60
1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 #include <vector> 5 using namespace std; 6 const int SIZE = 1e6; 7 int heap[SIZE], ...
分类:
编程语言 时间:
2020-07-25 23:58:20
阅读次数:
91
这个,输出为1 这个,啥都输不出来. 据说是因为没有初始化. 其实我搜了一下 1 vector<vector<int> > A;//正确的定义方式 2 vector<vector<int>> A;//c++11之前这样定义是错误的,c++11之后支持这种定义方式 因为>>会被认为是右移运算符 但是c ...
分类:
其他好文 时间:
2020-07-25 23:47:35
阅读次数:
79
函数简介 这些函数主要用于vector/set进行交集、并集、差集、对称差集的运算,他们包含在< algorithm >头文件内。 函数原型 交集 (set_intersection) template <class InputIterator1, class InputIterator2, cla ...
分类:
其他好文 时间:
2020-07-25 09:34:12
阅读次数:
81
#include <algorithm> #include <string> #include <cstring> #include <vector> #include <map> #include <stack> #include <set> #include <queue> #include < ...
分类:
其他好文 时间:
2020-07-24 23:42:50
阅读次数:
81
reg_test.cpp内容如下: #include <vector> #include <fmt/format.h> #include <console_color.h> #include <re2/re2.h> using namespace re2; using namespace std; ...
分类:
其他好文 时间:
2020-07-24 21:48:06
阅读次数:
101
线程安全:StringBuilder非线程 StringBuffer线程 / Vector线程 ArrayList非线程 / 快速迭代时不能有其他线程进行操作 进程:操作系统结构的基础:是一个正在执行的程序,计算机中正在运行的程序实例 线程:线程(thread)是进程中某个单一顺序的控制流,是程序运 ...
分类:
编程语言 时间:
2020-07-24 15:32:23
阅读次数:
61
根据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
题目来源:leetcode268 缺失数字 题目描述: 给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。 示例 1: 输入: [3,0,1] 输出: 2 示例 2: 输入: [9,6,4,2,3,5,7,0,1] 输出: 8 说明: ...
分类:
其他好文 时间:
2020-07-23 16:04:59
阅读次数:
78