2020. Remove One Element to Make the Array Strictly Increasing
My accepted Python solution to LeetCode problem 2020, Remove One Element to Make the Array Strictly Increasing, running in 191ms.
- Difficulty: Easy
- Python
- Runtime 191ms
- Memory 17.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 191ms, memory 17.3MB, accepted 2025-12-30.
class Solution:
def canBeIncreasing(self, nums: List[int]) -> bool:
def isStrictlyIncreasing(arr):
for i in range(1, len(arr)):
if arr[i] <= arr[i-1]:
return False
return True
# Check if already strictly increasing
if isStrictlyIncreasing(nums):
return True
# Try removing each element
for i in range(len(nums)):
new_arr = nums[:i] + nums[i+1:]
if isStrictlyIncreasing(new_arr):
return True
return False