Prime Sum

Given an even number ( greater than 2 ), return two prime numbers whose sum will be equal to given number.

NOTE A solution will always exist. read Goldbach’s conjecture

Example:


Input : 4
Output: 2 + 2 = 4

If there are more than one solutions possible, return the lexicographically smaller solution.

If [a, b] is one solution with a <= b,
and [c,d] is another solution with c <= d, then

[a, b] < [c, d] 

If a < c OR a==c AND b < d. 
Interview Code Editor
Hints
  • Hint 1
  • Solution Approach
  • Complete Solution
9233 successful submissions.
Asked In:
  • Epic systems
Click here to jump start your coding interview preparation