✅C++🔥| Simple | Sieve of Eratosthenes
Intuition\n1. Create a list of size n.  \n2. Mark all the numbers which are divisible by 2 and are greater than or equal to the square of it. \n3. Now move to n
# Intuition\n1. Create a list of size n.  \n2. Mark all the numbers which are divisible by 2 and are greater than or equal to the square of it. \n3. Now move to next unmarked number 3 and mark all the numbers which are multiples of 3 and are greater than or equal to the square of it. \n4. Above proccess continues till the square root of n.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n*log(log(n)))\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    vector<bool> primes;\n    void SieveOfEratosthenes(int n)\n    {\n        for (int p = 2; p * p <= n; p++) \n        {\n            if (primes[p] == true) \n            {\n                for (int i = p * p; i <= n; i += p)\n                    primes[i] = false;\n            }\n        }\n    }\npublic:\n    vector<vector<int>> findPrimePairs(int n) \n    {\n        primes.resize(n+1, true);\n        SieveOfEratosthenes(n);\n        vector<vector<int>> ans;\n        for(int i=2; i<=(n/2); i++)\n        {\n            if(primes[i] && primes[n-i]) ans.push_back({i, n-i});\n        }\n        return ans;\n    }\n};\n```
['C++']