Problem Description
You are given an array A of size N. In one operation, you can select any number from the array and reduce it to a divisor greater than 1. For example, you can reduce 12 to 2, 3 or 6.
The range of an array is the difference between the maximum element of the array and the minimum element. You want to find the minimum range of the array by doing any number of operations on the array. You can do multiple operations on a single element as well.
2 <= N, A[i] <= 105
Input 1:
A : [2, 4, 8]
Input 2:
A : [3, 8, 9]
Output 1:
0
Output 2:
1
Explanation 1:
The final array will be [2, 2, 2]
Explanation 2:
he final array will be [3, 2, 3]
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 question? Checkout Sample Codes for more details.