摘要: 1 //STL中Unique函数的作用是去除相邻重复元素 2 #include 3 #include 4 #include 5 using namespace std 6 int main() 7 { 8 int a[10] = { 7, 4, 1, 7, 4, 1, 7, 4, 1... 阅读全文
posted @ 2015-05-20 15:42 daijkstra 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 当结果不唯一的时候,使用STL去重的最简单方式是1 std::sort(res.begin(), res.end());2 res.erase(unique(res.begin(), res.end()), res.end());STL去重首先是2Sum题目,构建一个hash表查找数的对应下标,求两... 阅读全文
posted @ 2015-05-20 15:14 daijkstra 阅读(235) 评论(0) 推荐(0) 编辑