217.[Leetcode]Contains Duplicate
2016-05-02 20:43
393 查看
判断是否重复
class Solution { public: bool containsDuplicate(vector<int>& nums) { set<int> s; for(int i=0;i<nums.size();i++){ if(s.count(nums[i]) == 1) return true; else s.insert(nums[i]); } return false; } };
相关文章推荐
- Kafka设计解析(二)- Kafka High Availability (上)
- POJ11422 Air Raid
- “hackers and painters”读书笔记
- EasyChair提交会议论文的方法简介
- hduoj Train Problem I-1022
- POJ 1273 Drainage Ditches
- Matrix Chain Multiplication, UVa442
- Uva 514 Rails(栈应用)
- HDU 1789 Doing Homework again
- what's the cygwin and how cai i install this software
- 70. Climbing Stairs
- 服务器TIME_WAIT和CLOSE_WAIT详解和解决办法
- 70. Climbing Stairs
- container_of 宏、offsetof 宏 分析
- Flex AIR ANT 脚本编译
- CodeForces 667A Pouring Rain
- CodeForces 667A Pouring Rain
- hdu2925 Musical Chairs && poj3517 And Then There Was One(约瑟夫环)
- Raid 级别
- Hibernate运行报错Unknown entity: domain.UserBean