image_2021-10-29_15-02-21.png
33.8 KB
#N1346. Check If N and Its Double Exist
problem link=>https://leetcode.com/problems/check-if-n-and-its-double-exist/
#solution
problem link=>https://leetcode.com/problems/check-if-n-and-its-double-exist/
#solution
class Solution {
public boolean checkIfExist(int[] arr) {
for(int i=0; i<arr.length; i++){
for(int j=0; j<arr.length; j++){
if(arr[i]==2*arr[j]&&i!=j)
return true;
}
}
return false;
}
}