Tap here to switch tabs
Problem
Submissions

Problem: Find Greatest Common Divisor of Array

Find Greatest Common Divisor of Array asks you to identify the smallest and largest values in an integer array, then return the greatest positive integer that divides both.

Statement

Given an integer array nums, return the greatest common divisor of the smallest number and the largest number in nums.

Note: The greatest common divisor of two numbers is the largest positive integer that evenly divides both numbers.

Constraints:

  • 2≤2 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Greatest Common Divisor of Array

Find Greatest Common Divisor of Array asks you to identify the smallest and largest values in an integer array, then return the greatest positive integer that divides both.

Statement

Given an integer array nums, return the greatest common divisor of the smallest number and the largest number in nums.

Note: The greatest common divisor of two numbers is the largest positive integer that evenly divides both numbers.

Constraints:

  • 2≤2 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000