287. Find the Duplicate Number
来源:互联网 发布:淘宝运动服童装 编辑:程序博客网 时间:2024/04/29 16:58
很简单
class Solution {public: int findDuplicate(vector<int>& nums) { if(nums.size()<=1) return 0; sort(nums.begin(),nums.end()); for(int i=1;i<nums.size();i++) { if(nums[i]==nums[i-1]) return nums[i-1]; } return 0; }};
0 0
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287.Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 287. Find the Duplicate Number
- 数据结构 链表
- 安卓drawText中的坑
- PIC单片机-定时器的应用
- Android6.0权限申请讲解及Demo实例
- Java中this和super的用法
- 287. Find the Duplicate Number
- PIC单片机-利用Timer2定时器的溢出中断实现动态扫描数码管
- 第五次CSS作业
- 2.1 493. Reverse Pairs (Divide and Conquer)
- MVC 基础和增删改、登录
- 不使用库函数 字符串与整型 转换
- 第六第七次css作业 企业站
- 基于IjkPlayer的视频播放器
- PIC单片机-AD转换