An analytics dashboard stores deltas[i], the change in daily signups on day i compared with the day before. It can be negative.
Write strongestRun(deltas) that returns the largest sum of a run of one or more consecutive days.
Input: deltas = [-3,2,-4,5,-1,3,1,-6,4] Output: 8
Days 3 to 6: 5 - 1 + 3 + 1 = 8.
Input: deltas = [-3,-1,-2] Output: -1
Every day is negative, so the best run is the single day with -1.
1 <= deltas.length <= 100000-10000 <= deltas[i] <= 10000Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #495 Strongest Run of Daily Signups. 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.