题目描述
Given a number N, find if N can be expressed as a + b such that a and b are prime.
Note: If [a, b] is one solution with a <= b, and [c, d] is another solution with c <= d, and a < c then [a, b] is considered as our answer.
Example 1:
Input:
N = 8
Output:
3 5
Explanation:
3 and 5 are both prime and they
add up to 8.
Example 2:
Input:
N = 3
Output:
-1 -1
Explanation:
There are no solutions to the number 3.
Your Task:
You don't need to read input or print anything. Your task is to complete the function getPrimes() which takes an integer n as input and returns (a,b) as an array of size 2.
Note: If no value of (a,b) satisfy the condition return (-1,-1) as an array of size 2.
Expected Time Complexity: O(N*loglog(N))
Expected Auxiliary Space: O(N)
Constraints:
2 <= N <= 10^{6}
输入格式
见题面
输出格式
见题面