A fitness challenge scores each day in nums. A participant picks a run of back-to-back days and may drop at most one day from it (a "skip"). The run must still contain at least one day after the skip.
Write bestWithSkip(nums) that returns the largest total such a run can have.
Input: nums = [3,-4,2,-1,5] Output: 9
Take the whole run and skip -4: 3 + 2 - 1 + 5 = 9.
Input: nums = [-3,-1,-4] Output: -1
Every day is negative and at least one day must stay, so keep just -1.
1 <= nums.length <= 10^5-10^4 <= nums[i] <= 10^4Run 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 #65 Best Streak With One Skip. 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.