728x90
https://leetcode.com/problems/check-if-n-and-its-double-exist/
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
'알고리즘 > LeetCode' 카테고리의 다른 글
[LeetCode/easy/String] First The Difference (1) | 2022.09.20 |
---|---|
[LeetCode/easy/String] First Unique Character in a String (0) | 2022.09.20 |
[LeetCode/easy/String] Merge Strings Alternately (0) | 2022.08.16 |
[LeetCode/easy/String] Reverse Prefix of Word (0) | 2022.08.16 |
[LeetCode/easy/TwoPointer] Find First Palindromic String in the Array (0) | 2022.08.16 |