C++ Sieve of Eratosthenes
\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        vector<vector<int>> res;\n\n        // Hash prime numbers till n to check 
```\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        vector<vector<int>> res;\n\n        // Hash prime numbers till n to check in O(1) time\n        vector<bool> sieveIsPrime(n + 1, 0);\n        \n        // Sieve of Eratosthenes\n        vector<bool> seen(n + 1);\n        for (int i = 2; i <= n; i++) {\n            if(!seen[i]) {\n                sieveIsPrime[i] = 1;\n            }\n            for (int j = i * i; j <= n; j += i) {\n                seen[j] = 1;\n            }\n        }\n        \n        // Check for pairs\n        for (int i = 1; i <= n; i++)\n        {\n            if(sieveIsPrime[i] && sieveIsPrime[n - i]) {\n                res.push_back({i, n - i});\n                // To not count same pair twice\n                sieveIsPrime[i] = 0;\n            }\n        }\n        return res;\n    }\n};\n```
[]