i need to be even when checking set.contains(i / 2).
class Solution {
public boolean checkIfExist(int[] arr) {
if (arr == null || arr.length == 0) {
return false;
}
HashSet<Integer> set = new HashSet<>();
for (int i : arr) {
if (set.contains(i*2) || (i%2 == 0 && set.contains(i/2))) {
return true;
}
set.add(i);
}
return false;
}
}