FastPrepMaximum Product of a Strictly Increasing Contiguous Subarray
Problems/Maximum Product of a Strictly Increasing Contiguous Subarray

Maximum Product of a Strictly Increasing Contiguous Subarray

Infosys logoInfosys● MediumFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: This practice version is about a 70% match to the available source. The integer-array input, contiguous-subarray scope, increasing-order requirement, and maximum-product objective come directly from the source. The strict-increase interpretation, length-one behavior, input and product bounds, function signature, and examples were not shown, so FastPrep filled them in consistently without changing what the original question asks you to do.

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[]) → long

Examples

Example 1

nums = [2,3,4]return = 24

The entire array is strictly increasing, and its product is 2 * 3 * 4 = 24.

Example 2

nums = [3,2,4,5]return = 40

The 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 = 20

The 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

  • Swap Two Gender ValuesPHONE SCREEN · Seen Oct 2026
  • Count Equal-Distinct Character PartitionsOA · Seen Oct 2026
  • Maximize the Even-Odd Index Product GapONSITE INTERVIEW · Seen Oct 2026
All Infosys interview questionsSee Infosys hiring insights
Saved
class Solution {
    public long maximumProductIncreasingSubarray(int[] nums) {
        // write your code here
    }
}
Checking account…