码迷,mamicode.com
首页 > 其他好文 > 详细

LeetCode 1346. Check If N and Its Double Exist

时间:2020-02-09 20:44:13      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:ret   i++   and   bool   exist   ==   ++   problem   pre   

题目

class Solution {
public:
    bool checkIfExist(vector<int>& arr) {
        
        for(int i=0;i<arr.size();i++)
        {
            for(int j=0;j<arr.size();j++)
            {
                if(i==j)
                    continue;
                if(arr[i]==arr[j]*2)
                    return true;
            }
        }
        
        return false;
        
    }
};

LeetCode 1346. Check If N and Its Double Exist

标签:ret   i++   and   bool   exist   ==   ++   problem   pre   

原文地址:https://www.cnblogs.com/dacc123/p/12288369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!