In a game, each round gives a whole-number multiplier in nums (zero or negative multipliers are bad luck). A combo multiplies the multipliers of back-to-back rounds.
Write bestComboProduct(nums) that returns the largest product of a run of at least one back-to-back round.
Input: nums = [3,-1,4,-2] Output: 24
The two negatives cancel out: 3 * -1 * 4 * -2 = 24.
Input: nums = [-3,0,-1] Output: 0
The single round with 0 beats every other run.
1 <= nums.length <= 2 * 10^5-10 <= nums[i] <= 10Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #62 Best Multiplier Streak. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.