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;
        
    }
};
原文地址:https://www.cnblogs.com/dacc123/p/12288369.html