An animation chains scale transforms, and factors[i] is the whole-number multiplier of step i. A negative factor flips the element.
Write largestProductRun(factors) that returns the largest product of a run of one or more consecutive factors.
Input: factors = [3,2,-3,5] Output: 6
The run [3, 2] gives 6. Adding -3 makes it negative.
Input: factors = [-3,0,-2] Output: 0
Every run with two or more factors includes the 0, and the single factors are -3, 0, and -2.
1 <= factors.length <= 200000-10 <= factors[i] <= 10-10^15 and 10^15, so it fits exactly in a JavaScript number.Run 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 #497 Largest Scale Multiplier Run. 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.