Longest Non-Decreasing Run After One Change

Asked at GoogleOnsite

Reported by the problem's creator, not verified

You are given an array of integers nums.

Examples

  1. Example 1

    Input: nums = [1,0,3,4,5,2,3]

    Output: 5

    Explanation: Change the 0 to 1, 2 or 3; then [1, 2, 3, 4, 5] is non-decreasing with length 5. No single change also brings in the trailing 2, 3.

Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question

Code

Loading editor…

Ln 1, Col 1

Start an attempt to use Coach.