Tap here to switch tabs
Problem
Submissions

Problem: Find Greatest Common Divisor of Array

med
30 min
Try to solve the Find Greatest Common Divisor of Array problem.

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

med
30 min
Try to solve the Find Greatest Common Divisor of Array problem.

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