Peak Product
HardAcc. 64.2%
+50 XP 30
Multiplicative Max
Given an array, find the maximum product of any contiguous slice.
The Assignment
Your function receives nums.
- For simplicity, use nested loops to check all possible subarrays.
- Track the
maxProduct. - Print the Result.
01EXAMPLE 1
Input
[2, 3, -2, 4]Output
6Explanation: Subarray [2, 3] product is 6.
Constraints
- Handle negative numbers.
ArraysAlgorithms
JavaScriptSystem handles I/O — write your function only
Loading...
1 Hidden
Input Arguments
nums[2,3,-2,4]
Expected Output
6
Click RUN to test your solution