You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNestProblem Set
🔥Maximum Product Subarray: Dual Running ExtremesMedium
DAILY PROBLEM OF THE DAY+50 XP • Daily Streak
Solve today's challenge or tackle one of the 3 Super Hard challenges for +150 XP.
MediumDynamic Programming•Acceptance: 35.1%
Maximum Product Subarray: Dual Running Extremes
Targeted in FAANG & Tech OA:AmazonGoogleMicrosoft
Real-World Engineering Context
Used in economic compounding yield modeling and signal amplifier cumulative gain chain optimizers.
Given an integer array `nums`, find a subarray that has the largest product, and return the product.
The test cases are generated so that the answer will fit in a 32-bit integer.
Sample Test Cases
Input: [[2,3,-2,4]]
Expected: 6
Input: [[-2,0,-1]]
Expected: 0
Input: [[-2,3,-4]]
Expected: 24
Constraints
- 1 <= nums.length <= 2 * 10^4
- -10 <= nums[i] <= 10
Recruiter Fast-Track ReferralVerified Candidate
Direct pipeline to Google, Amazon, Microsoft, Swiggy, & Uber recruiters
Top DevScore profiles bypass resume screening filters. Every verified problem solve writes authentic proof-of-work to your profile and dispatches you directly into employer inboxes on RoleNest.
Explore 5,000+ Direct ATS Openings on RoleNest ↗✓ Direct Referral Active
Language:
Ready to test. Click Run Code or Submit Solution to run test cases in isolated browser sandbox.