class Solution {
public boolean checkIfExist(int[] arr) {
boolean result = false;
for(int i = 0; i < arr.length; i++) {
for(int j = 0; j < arr.length; j++) {
if(j == i)
continue;
if(arr[i] * 2 == arr[j]){
result = true;
break;
}
}
}
return result;
}
}
'JAVA > leetcode' 카테고리의 다른 글
[LeetCode] Array - Replace Elements with Greatest Element on Right Side (0) | 2021.08.05 |
---|---|
[LeetCode] Array - Valid Mountain Array (0) | 2021.08.05 |
[LeetCode] Array - Remove Duplicates from Sorted Array !! (0) | 2021.08.05 |
[LeetCode] Array - Remove Element !! (0) | 2021.08.05 |
[LeetCode] Array - Merge Sorted Array (0) | 2021.08.05 |