Problem · Array
Maximum Product of a Strictly Increasing Contiguous Subarray
Learn this problemProblem statement
Given an integer array nums, choose a non-empty contiguous subarray whose values are in strictly increasing order.
A subarray nums[l..r] is eligible when nums[i] < nums[i + 1] for every index i from l through r - 1. A subarray containing one element is eligible.
Return the maximum product of the elements in any eligible subarray.
Function
maximumProductIncreasingSubarray(nums: int[]) → longExamples
Example 1
nums = [2,3,4]return = 24The entire array is strictly increasing, and its product is 2 * 3 * 4 = 24.
Example 2
nums = [3,2,4,5]return = 40The increase breaks between 3 and 2. Within the increasing run [2,4,5], the subarray [2,4,5] has product 40, which is the maximum.
Example 3
nums = [-5,-4,-3]return = 20The array is strictly increasing, but using every element gives -60. The eligible subarray [-5,-4] has product 20, which is larger than every other eligible product.
Constraints
1 <= nums.length <= 100000-1000000000 <= nums[i] <= 1000000000- The product of every eligible subarray fits in a signed 64-bit integer.
More infosys problems
- Count Valid A-B-C Sequences Under a Modulo-Four RuleOA · Seen Aug 2026
- Minimum Cost to Assign Candidates to Two CitiesOA · Seen Aug 2026
- Minimum Path Sum With Grid SwitchesONSITE INTERVIEW · Seen May 2026
- Maximum Subarray Sum After SwapsOA · Seen Feb 2026
- Find Number of Good Subsequences 🍅OA · Seen Apr 2024
- Number of Unique Elements After Modifications 🍁OA · Seen Mar 2024
- Obtain Maximum Score Using Minimum SwapsOA · Seen Feb 2024
- Extract CardsOA · Seen Feb 2024