c++ solution using sieve of Eratosthenes
Complexity\n- Time complexity:\nO(n*log(log(n)))\n\n- Space complexity:\nO(n)\n\n# Code\n\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int
# Complexity\n- Time complexity:\nO(n*log(log(n)))\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        bool prime[n + 1];\n        memset(prime , true , sizeof(prime));\n\n        prime[0] = false;\n        prime[1] = false;\n\n        for(int i = 2 ; i * i <= n ; i++) {\n            if(prime[i]) {\n                for(int j = i * i ; j <= n ; j += i) \n                prime[j] = false;\n            }\n        }\n\n        vector<vector<int>> ans;\n\n        for(int i = 2 ; i <= n / 2 ; i++) {\n            if(prime[i] && prime[n - i])\n            ans.push_back({i , n - i});\n        }\n\n        return ans;\n    }\n};\n```
['C++']