EZPZ

Given a number N, find the minimum number of prime numbers required, whose summation gives you N.

Eg: N = 4

4 can be denoted as 2 + 2, hence minimum number of primes needed is 2.

If not possible, return -1.

Note that 1 is not a prime number.

Input:

N: Integer

Output:

Integer

Constraints:

0 <= N <= 10^9

Example:

Input

N: 9

Output

2

9 = 2 + 7

Input

N: 11

Output

1

11 itself is a prime.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving EZPZ on Interview Code Editor
Sign Up
to access hints and editorial solutions for EZPZ

Discussion


Loading...
Click here to start solving coding interview questions