Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray With Equal Products

med
30 min
Try to solve the Maximum Subarray With Equal Products problem.

Statement

Given an array of positive integers nums.

A subarray of nums is defined as product equivalent if the product of all its elements is equal to the product of the greatest common divisor (gcd⁡\gcd) and the least common multiple (lcm⁡\operatorname{lcm}) of all its elements.

Return the maximum length of a product equivalent subarray of nums.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray With Equal Products

med
30 min
Try to solve the Maximum Subarray With Equal Products problem.

Statement

Given an array of positive integers nums.

A subarray of nums is defined as product equivalent if the product of all its elements is equal to the product of the greatest common divisor (gcd⁡\gcd) and the least common multiple (lcm⁡\operatorname{lcm}) of all its elements.

Return the maximum length of a product equivalent subarray of nums.

Constraints:

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

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