leetcode287. Find the Duplicate Number
来源:互联网 发布:外包软件开发公司 编辑:程序博客网 时间:2024/06/06 09:04
找出这些串中一个重复。
遍历一遍,然后用vector的find函数去查找就好了。
查找之前要把当前值记录一下,并删去,找到不久是这个重复了吗。
class Solution {public: int findDuplicate(vector<int>& nums) { for(int i=0;i<nums.size();i++){ int x=nums[i]; nums[i]=-1; if(find(nums.begin(),nums.end(),x)!=nums.end()) return x; } }};
阅读全文
0 0
- leetcode287 : Find the Duplicate Number
- [leetcode287] Find the Duplicate Number
- leetcode287 Find the Duplicate Number
- leetcode287: Find the Duplicate Number
- leetcode287. Find the Duplicate Number
- leetcode287. Find the Duplicate Number
- leetcode287. Find the Duplicate Number
- leetcode287. Find the Duplicate Number
- Leetcode287 - Find the Duplicate Number(二分)
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- Find the Duplicate Number
- kubernetes1.5.2--部署dashboard服务
- MediaRecorder.AudioSource音频参数说明
- 目标检测的图像特征提取之(三)Haar特征
- 大数据分析案列
- 流程控制
- leetcode287. Find the Duplicate Number
- ObjectOutputStream-ObjectInputStream的使用
- Map集合知识点,
- 微信公众号获取用户的openid
- 快速制作表单验证
- 做毕设(三)——用户界面
- 微信公众号开发之微信支付开发
- 最佳的远程桌面连接工具
- bzoj 3123(主席树+启发式合并)