893. Express Number as Sum of Two Primes

Given an integer n, determine whether it can be expressed as the sum of two prime numbers.

You must return true if such a pair exists, otherwise return false.

Example 1:

Input: n = 74

Output: True

Explanation: 74 = 71 + 3, and both 71 and 3 are prime numbers.

Example 2:

Input: n = 11

Output: False

Explanation: There are no two prime numbers whose sum is 11.

Now Your Turn!

Pick the correct output for the given input

Input: n = 4

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 2 <= n <= 106

Fun Facts

0
class Solution {
public:
bool isSumOfTwoPrimes(int n) {
// Your code goes here
}
};
Test Case

Input:

N