알고리즘/LeetCode

[LeetCode/easy/TwoPointer] Check If N and Its Double Exist

녕이 2022. 8. 17. 15:17
728x90

 

https://leetcode.com/problems/check-if-n-and-its-double-exist/

 

Check If N and Its Double Exist - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

 

 

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

 

 

728x90