Non-decreasing Array
Problem statement
Return whether nums can become nondecreasing by modifying at most one element to any integer value.
Function
canBeNonDecreasing(nums: int[]) → booleanExamples
Example 1
nums = [4,2,3]return = trueChange 4 to 1.
Example 2
nums = [4,2,1]return = falseOne change cannot repair both drops.
Constraints
1 <= nums.length <= 10^5.- Values are 32-bit signed integers.