[C++] straightforward solution - no set/map required
Intuition\nUse \'sieve of eratosthenes\' algorithm to find the vector of all primes less than equal to \'n\'.\n\n\n# Code\n\nclass Solution {\npublic:\n    vect
# Intuition\nUse \'sieve of eratosthenes\' algorithm to find the vector of all primes less than equal to \'n\'.\n\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        \n// sieve of eratosthenes -> to get all primes from 2 to n (n<=1e6);\n        vector<int> prime(n+1,true);\n        prime[0]=prime[1]=false;\n\n        for(int i=2; i*i<=n; i++){\n\n            if(prime[i]==true){\n                for(int j=i*i; j<=n; j=j+i){\n                    prime[j]=false;\n                }\n            }\n        }\n// checking the \'prime\' vector to obtain i and j where (i+j==n)\n        vector<vector<int>>ans;\n\n        for(int i=2; i<n; i++){\n            int j = n-i;\n            if(prime[i]&&prime[j]&&i<=j){\n                ans.push_back({i,j});\n            }\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'C++']