Easy C++ solution with Sieve of Eratosthenes Algorithm
Intuition\nSimply using Sieve of eratosthenes.\n\n# Approachf\ndue to this algorithm, we can find prime numbers in O(1). each query of numbers to check the sum.
# Intuition\nSimply using Sieve of eratosthenes.\n\n# Approachf\ndue to this algorithm, we can find prime numbers in O(1). each query of numbers to check the sum.\n\n# Complexity\n- Time complexity:\nSieve of Eratosthenes: O(nloglogn)\nFinding Prime Pairs: O(n)\nOutputting Results: O(n)\nOverall : O(nloglogn)\n- Space complexity:\noverall : O(n)\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        vector<int> prime(n+1,1);\n        prime[0] = 0;\n        prime[1] = 0;\n\n        for(int i = 2; i <= n; i++){\n            if(prime[i] == 1)\n            for(int j = i+i; j <= n; j += i){\n                prime[j] = 0;\n            }\n        }\n        vector<vector<int>> res;\n        for(int i = 1; i <= n/2; i++){\n            vector<int> t;\n            if(prime[i] && prime[n-i]){\n                t.push_back(i);\n                t.push_back(n-i);\n                res.push_back(t);\n            }\n        }\n        return res;\n    }\n};\n```
['Array', 'Math', 'Number Theory', 'C++']