Error
|
|
---|---|
@Ibrahim Nash | 5765 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4993 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1286 |
@bt8816103042 | 739 |
@rohitanand | 495 |
@codeantik | 479 |
@shalinibhataniya1097 | 472 |
@amrutakashikar2 | 464 |
@thealchemist627 | 456 |
@akashkale117 | 453 |
@shivanandp12345678910 | 453 |
@dalwainazism125 | 453 |
@SherlockHolmes3 | 447 |
Complete Leaderboard |
Given an even number N (greater than 2), return two prime numbers whose sum will be equal to given number. There are several combinations possible. Print only the pair whose minimum value is the smallest among all the minimum values of pairs.
NOTE: A solution will always exist, read Goldbach’s conjecture.
Example 1:
Input: N = 74
Output: 3 71
Explaination: There are several possibilities
like 37 37. But the minimum value of this pair
is 3 which is smallest among all possible
minimum values of all the pairs.
Example 2:
Input: 4
Output: 2 2
Explaination: This is the only possible
prtitioning of 4.
Your Task:
You do not need to read input or print anything. Your task is to complete the function primeDivision() which takes N as input parameter and returns the partition satisfying the condition.
Expected Time Complexity: O(N*log(logN))
Expected Auxiliary Space: O(N)
Constraints:
1 ≤ N ≤ 104
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes