LeetCode 1346. Check If N and Its Double Exist

题目

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;
        
    }
};
posted @ 2020-02-09 19:28  Shendu.CC  阅读(149)  评论(0编辑  收藏  举报