GCD of Smallest and Largest
Find the smallest and the largest number in nums, and return the greatest common divisor of those two numbers.
Example 1
nums [2,5,6,9,10]
returns 2
gcd(2, 10) = 2.
Example 2
nums [7,5,6,8,3]
returns 1
gcd(3, 8) = 1.
Constraints
1 <= len(nums) <= 501 <= nums[i] <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.