The Chosen One - Hackerrank Problem Solution
The Chosen One
Hackerrank Problem Solution
PROBLEM STATEMENT
You are given a sequence of integers, . Find and print any integer such that is divisor of every except for exactly one element.
Input Format
The first line contains an integer, , denoting the length of the sequence.
The second line contains positive space-separated integers describing .
Constraints
- It is guaranteed that a solution exists.
Output Format
Print any positive integer denoting such that is a divisor of exactly of the sequence's elements. must be between and
Sample Input 0
4
3 6 18 12
Sample Output 0
6
Explanation 0
We are given the array . There are two possible answers:
- is a divisor of , , and but not a divisor of .
- is a divisor of , , and but not a divisor of .
Thus, we can print either or as our answer.
SOLUTION
SHARE
If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
CODE TOGETHER..GROW TOGETHER.
Newer Posts
Newer Posts
Older Posts
Older Posts
Comments