C++ || Simple Approach || Beginner Friendly || Sieve of Eratosthenes || Brute Force
Intuition\n Describe your first thoughts on how to solve this problem. \nCheck all the pairs of that sum up to n whether they are prime or not.\n\n# Approach\n 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCheck all the pairs of that sum up to n whether they are prime or not.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Create a vector of size (n+1) initialized true to represent whether the number at that index is prime or not.\n2. Mark the mulitples of the prime numbers to be false in that vector.\n3. Take two variables i and j to represent the two numbers that sum up to be n.\n4. Run a loop from i = 2 to n/2 and calculate corresponding value of j = n-i in each loop.\n5. Check if both i and j are prime then add the pair to ans.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(nlogn) for finding prime numbers\n    O(n) for finding pairs\n\n    So, finally\n    O(nlogn)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> findPrimePairs(int n) {\n        //if n<4 then it can\'t be sum of two prime nos.\n        if (n<4) return {};\n\n        //a vector to indicate prime nos. <= n\n        vector<bool> prime(n+1,true);\n\n        // 0 and 1 are not prime\n        prime[0]=prime[1]=false;\n\n        // 2 onwards marking all the numbers that are multiples of\n        // prime number to be not prime by marking them false\n        for(int i=2;i<=n;i++)\n          if(prime[i] && (long long)i*i<=n)\n              for(int j=i*i;j<=n;j+=i) prime[j] = false;\n\n        vector<vector<int>> ans;\n        int i=2,j;\n\n        // starting a loop form i=2 i.e. first prime no.\n        // taking loop till n/2 since pairs will start repeating in\n        //opposite order after that\n        while(i<=n/2){\n            j=n-i;\n\n            //if i and j are prime, push the pair in ans\n            if(prime[i] && prime[j]) ans.push_back({i,j});\n\n            i++;\n        }\n\n        return ans;\n    }\n};\n```
['C++']