Practice Maximum Subarray With Equal Products
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Easy#3411
LeetCode ProblemMaximum Subarray With Equal Products
Problem Statement
Given a positive integer array nums, find the longest contiguous subarray for which the product of all its elements equals their greatest common divisor multiplied by their least common multiple. Return that subarray’s length.
Source: Maximum Subarray With Equal Products on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,2,1,2,1,1,1]
Output
5
# Example 2
Input
nums = [2,3,4,5,6]
Output
3
# Example 3
Input
nums = [1,2,3,1,4,5,1]
Output
5
Constraints
2 <= nums.length <= 100
1 <= nums[i] <= 10
Related LeetCode Problems
Practice more problems similar to Maximum Subarray With Equal Products.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.