You are given an array of positive integers nums.
An array arr is called product equivalent if prod(arr) == lcm(arr) * gcd(arr), where:
Return the length of the longest product equivalent subarray of nums.
Input: nums = [2,3,4,5,6]
Output: 3
Explanation:
The longest product equivalent subarray is [3, 4, 5].
Example 3
Input: nums = [1,2,3,1,4,5,1]
Output: 5
Constraints
2 <= nums.length <= 100
1 <= nums[i] <= 10
3411. Maximum Subarray With Equal Products
Easy
10 Points
Array
Math
Sliding Window
Enumeration
Number Theory
You are given an array of positive integers nums.
An array arr is called product equivalent if prod(arr) == lcm(arr) * gcd(arr), where:
Return the length of the longest product equivalent subarray of nums.