Given an integer array nums, return gcd(min(nums), max(nums)). This is the standard array gcd problem that depends on the extreme values of the array.
nums = array of positive integers
gcd of the minimum and maximum elements in nums
Example 1:
Input:
nums = [2,5,6,9,10]
Output:
2
Explanation:
gcd(min=2, max=10) = 2.
Example 2:
Input:
nums = [7,5,6,8,3]
Output:
1
Explanation:
gcd(min=3, max=8) = 1.