总结一下map::erase的正确用法。 首先看一下在循环中使用vector::erase时我习惯的用法: 程序从一个vector中删除值为0的元素,利用了vector::erase函数根据iterator删除某个元素时会返回下一个元素的iterator的性质: http://www.cpluspl ...
分类:
编程语言 时间:
2019-05-19 19:26:56
阅读次数:
145
其实也米有很难……只是c++11的api这么好用的吗 Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get ...
分类:
系统相关 时间:
2019-05-04 09:28:25
阅读次数:
144
要做就做深做精! 问题: 什么是enhancer?一般多长?enhancer可能会出现在基因组的哪些区域?promoter呢? enhancer和promoter的关系?enhancer、promoter、TF和RNA聚合酶II是如何在一起作用的? enhancer如何影响基因表达? 如何鉴定enh ...
分类:
其他好文 时间:
2019-05-02 18:54:45
阅读次数:
877
You are playing the following game with Joisino. Initially, you have a blank sheet of paper. Joisino announces a number. If that number is written on ...
分类:
其他好文 时间:
2019-04-29 20:56:37
阅读次数:
126
Del (erase) 删除指定文件 语法: DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names attributes 属性ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names del[盘符:][路径] ...
分类:
其他好文 时间:
2019-04-22 09:20:37
阅读次数:
183
使用string::iterator(字符串迭代器)从开始 str.begin() 迭代到最后 str.end() ,再使用string.erase(const_iterator p)函数来删除迭代器所指向的字符。 ...
分类:
编程语言 时间:
2019-03-31 23:17:38
阅读次数:
225
Extending Set of Points 我们能发现, 如果把x轴y轴看成点, 那么答案就是在各个连通块里面的x轴的个数乘以y轴的个数之和。 然后就变成了一个并查集的问题, 但是这个题目里面有撤销的操作, 所以我们要把加入和撤销操作变成 这个点影响(L , R)之间的询问, 然后把它丢到线段树 ...
分类:
其他好文 时间:
2019-03-27 12:49:13
阅读次数:
175
stl容器:vector,deque,list,map/multimap,set 特殊容器:stack,queue,priority_queue 通用操作 size() 返回当前容器元素数量 empty() 判断容器是否为空 max_size() 返回容器能容纳的最大元素数量 与迭代器有关的操作 b ...
分类:
其他好文 时间:
2019-03-24 09:34:28
阅读次数:
138
参考:https://leetcode.com/problems/check-if-word-is-valid-after-substitutions/discuss/247626/JavaPythonC%2B%2B-Stack-Solution-O(N 方法1:使用c++自带的find函数和era ...
分类:
其他好文 时间:
2019-03-16 14:16:40
阅读次数:
198
A:显然每种字符的代价互不相关,dp并打表可得合并i个字符的最小代价是i*(i-1)/2。然后直接贪心分配每个字符即可。因为每次分配都将剩余代价降到了根号级别所以字符数量是足够的。 B:先找出每个会撞在一起的集合,然后可以发现相当于是在网格图中向某方向走遇到一个格点就拐个弯,讨论一下即可。 C:显然 ...
分类:
其他好文 时间:
2019-03-09 23:38:19
阅读次数:
171