package leetcode;

/**
 * https://leetcode.com/problems/check-if-n-and-its-double-exist/
 */
public class Problem1346 {
    public boolean checkIfExist(int[] arr) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1346 prob = new Problem1346();
        System.out.println(prob.checkIfExist(new int[]{10,2,5,3})); // true
        System.out.println(prob.checkIfExist(new int[]{7,1,14,11})); // true
        System.out.println(prob.checkIfExist(new int[]{3,1,7,11})); // false
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -219,86 +219,91 @@
     
-// TODO%0A        return false
+Set%3CInteger%3E set = new HashSet%3C%3E();%0A        int nZero = 0
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args
+for (int n : arr
 ) %7B%0A
@@ -314,121 +314,148 @@
     
-Problem1346 prob = new Problem1346();%0A        System.out.println(prob.checkIfExist(new int%5B%5D%7B10,2,5,3%7D)); //
+    if (n == 0) %7B%0A                nZero++;%0A            %7D%0A            set.add(n);%0A        %7D%0A        if (nZero %3E 1) %7B%0A            return
  true
+;
 %0A   
@@ -463,153 +463,231 @@
     
-System.out.println(prob.checkIfExist(new int%5B%5D%7B7,1,14,11%7D)); // true%0A        System.out.println(prob.checkIfExist(new int%5B%5D%7B3,1,7,11%7D)); //
+%7D%0A        for (int n : arr) %7B%0A            if (n == 0) %7B%0A                continue;%0A            %7D%0A            if (n %25 2 == 0 && set.contains(n / 2)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return
  false
+;
 %0A   

Solve problem 1346