Ctrl K

One Removal to a Strict Climb

Easy
You are given an integer array nums. An array is strictly increasing when each element after the first is larger than the one before it. Can you delete exactly one element from nums so that what remains is strictly increasing? If nums is already strictly increasing, the answer is true. Return true or false.
Example 1
nums=[4, 6, 5, 8] → True

Removing 6 gives [4, 5, 8], where every number is larger than the one before it.

Example 2
nums=[5, 4, 3] → False

There are two drops in a row; whichever element goes, one drop remains.

Example 3
nums=[1, 2, 3] → True

The array already strictly increases, and it still does after removing any element.

Constraints
  • 2 ≤ nums.length ≤ 10⁵
  • 1 ≤ nums[i] ≤ 10⁵
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsPair With a Target Sum EasySqueeze Repeats Out of a Sorted Array EasyDrop the Unwanted Value EasySlot on a Sorted Shelf EasyAdd One to a Digit Array Easy
loading Python…
Input
nums=[4, 6, 5, 8]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 181 tests on the server, hidden ones included.