Easy to understand Java solution || Beats 70%
Complexity\n- Time complexity:O(N)\n Add your time complexity here, e.g. O(n) \n- Space complexity:O(N)\n Add your space complexity here, e.g. O(n) \n\n# Code\n
# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public List<List<Integer>> findPrimePairs(int n) {\n        boolean isPrime[] = new boolean[n+1];\n        Arrays.fill(isPrime, true);\n        isPrime[0] = false;\n        isPrime[1] = false;\n        for (int i = 2; i <= Math.sqrt(n); i++) {\n            if (isPrime[i] == true) {\n                for (int j = i * 2; j <= n; j += i) {\n                    isPrime[j] = false;\n                }\n            }\n        }\n        List<List<Integer>> l1 = new ArrayList<>();\n        Set<Integer> st = new HashSet<>();\n        for (int i = 2; i < n; i++) {\n            if(i+i > n)break;\n            if (isPrime[i] && isPrime[n - i]) {\n                l1.add(Arrays.asList(i, n - i));\n            }\n        }\n        return l1;\n    }\n}\n```
['Array', 'Math', 'Enumeration', 'Number Theory', 'Java']