Give two versions of WA code:
Version 1: Runtime Error: Find the bug
class Solution {
public:
void find(const string& s, const unordered_set& dict, vector& res) {
int i, j, len = s.length();
...
分类:
其他好文 时间:
2014-08-03 15:21:27
阅读次数:
329
C++11 引进了无序关联容器(unordered associative containers)的概念。 有unordered set or multiset, 以及unordered map or multimap。
顾名思义, unordered的意思就是元素没有固定的顺序, 并且元素的顺序可能会随着时间的变化而变化。
Internally, unordered contai...
分类:
编程语言 时间:
2014-07-26 15:03:20
阅读次数:
220
今天在Ubuntu下写一个程序的时候用到了hash_set容器,出现一点问题,在这里记录一下,先说一下,hash_*系列例如hash_map,hash_set 等已经被废弃了,C++11用unordered_map,unordered_set等来替代,但是我用的g++ 4.6.1警告说C++11特性是实验性的,貌似到4.8才完全支持。所以就改用hash_set了,写了如下的程序:
#includ...
分类:
其他好文 时间:
2014-07-06 12:47:24
阅读次数:
209
好奇心来源于下面的一段代码, 一个是unordered_map, 这是c++11新加的container. 另外还有unordered_set,
unordered_multimap, unordered_multiset.另外在for循环中, 可以使用下列形式:1 for (auto
&eleme...
分类:
编程语言 时间:
2014-05-15 12:03:28
阅读次数:
339
class Solution {private: vector result;public:
vector wordBreak(string s, unordered_set &dict) { vector > dp;
result.clear(); ...
分类:
其他好文 时间:
2014-05-08 01:00:03
阅读次数:
361