🌟✅Best C++ Code💯 || Sieve of Eratosthenes🔥💯
Connect on LinkedIn : https://www.linkedin.com/in/aditya-jhunjhunwala-51b586195/\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\
### Connect on LinkedIn : https://www.linkedin.com/in/aditya-jhunjhunwala-51b586195/\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n## Please Upvote if u liked my Solution\uD83E\uDD17\n```\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        vector<vector<int>> ans;\n        if(n == 1 || n == 2)\n            return ans;\n        vector<bool> findPrime(n+1,true);\n        for(int i=2;i<sqrt(n);i++){\n            for(int j=i*i;j<=n;j+=i){\n                findPrime[j]=false;\n            }\n        }\n        for(int i = 2; i < n; i++){\n            if(findPrime[i]){\n                int x = i, y = n - x;\n                if(y < x)\n                    break;\n                if(findPrime[y])\n                    ans.push_back({x,y});\n            }\n        }\n        return ans;\n    }\n};\n```\n![e2515d84-99cf-4499-80fb-fe458e1bbae2_1678932606.8004954.png](https://assets.leetcode.com/users/images/ee60bc65-95f3-44df-a05f-3e8d64696b9d_1688273441.7786038.png)\n
['Math', 'C++']