Tap here to switch tabs
Problem
Submissions

Problem: Minimum Split Into Subarrays With GCD Greater Than One

Minimum Split Into Subarrays With GCD Greater Than One asks you to divide an integer array into the fewest contiguous, nonempty parts so every part has a GCD greater than one.

Statement

Given an array of integers nums, split nums into the minimum number of contiguous subarrays such that the greatest common divisor (GCD) of all elements in each subarray is strictly greater than 11.

Return the minimum number of subarrays required to achieve this split.

Note: A subarray is a contiguous non empty sequence of elements within an array. The greatest common divisor (GCD{GCD}) of a sequence of integers is the largest positive integer that evenly divides each integer in the sequence.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • 2≤2 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Split Into Subarrays With GCD Greater Than One

Minimum Split Into Subarrays With GCD Greater Than One asks you to divide an integer array into the fewest contiguous, nonempty parts so every part has a GCD greater than one.

Statement

Given an array of integers nums, split nums into the minimum number of contiguous subarrays such that the greatest common divisor (GCD) of all elements in each subarray is strictly greater than 11.

Return the minimum number of subarrays required to achieve this split.

Note: A subarray is a contiguous non empty sequence of elements within an array. The greatest common divisor (GCD{GCD}) of a sequence of integers is the largest positive integer that evenly divides each integer in the sequence.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • 2≤2 \leq nums[i] ≤109\leq 10^9