1909. Remove One Element to Make the Array Strictly Increasing LeetCode Solution
In this guide, you will get 1909. Remove One Element to Make the Array Strictly Increasing LeetCode Solution with the best time and space complexity. The solution to Remove One Element to Make the Array Strictly Increasing problem is provided in various programming languages like C++, Java, and Python. This will be helpful for you if you are preparing for placements, hackathons, interviews, or practice purposes. The solutions provided here are very easy to follow and include detailed explanations.
Table of Contents
- Problem Statement
- Complexity Analysis
- Remove One Element to Make the Array Strictly Increasing solution in C++
- Remove One Element to Make the Array Strictly Increasing solution in Java
- Remove One Element to Make the Array Strictly Increasing solution in Python
- Additional Resources

Problem Statement of Remove One Element to Make the Array Strictly Increasing
Given a 0-indexed integer array nums, return true if it can be made strictly increasing after removing exactly one element, or false otherwise. If the array is already strictly increasing, return true.
The array nums is strictly increasing if nums[i – 1] < nums[i] for each index (1 <= i < nums.length).
Example 1:
Input: nums = [1,2,10,5,7]
Output: true
Explanation: By removing 10 at index 2 from nums, it becomes [1,2,5,7].
[1,2,5,7] is strictly increasing, so return true.
Example 2:
Input: nums = [2,3,1,2]
Output: false
Explanation:
[3,1,2] is the result of removing the element at index 0.
[2,1,2] is the result of removing the element at index 1.
[2,3,2] is the result of removing the element at index 2.
[2,3,1] is the result of removing the element at index 3.
No resulting array is strictly increasing, so return false.
Example 3:
Input: nums = [1,1,1]
Output: false
Explanation: The result of removing any element is [1,1].
[1,1] is not strictly increasing, so return false.
Constraints:
2 <= nums.length <= 1000
1 <= nums[i] <= 1000
Complexity Analysis
- Time Complexity: O(n)
- Space Complexity: O(1)
1909. Remove One Element to Make the Array Strictly Increasing LeetCode Solution in C++
class Solution {
public:
bool canBeIncreasing(vector<int>& nums) {
bool removed = false;
for (int i = 1; i < nums.size(); ++i)
if (nums[i - 1] >= nums[i]) {
if (removed)
return false;
removed = true; // Remove nums[i - 1].
if (i > 1 && nums[i - 2] >= nums[i])
nums[i] = nums[i - 1]; // Remove nums[i] instead.
}
return true;
}
};
/* code provided by PROGIEZ */
1909. Remove One Element to Make the Array Strictly Increasing LeetCode Solution in Java
class Solution {
public boolean canBeIncreasing(int[] nums) {
boolean removed = false;
for (int i = 1; i < nums.length; ++i)
if (nums[i - 1] >= nums[i]) {
if (removed)
return false;
removed = true; // Remove nums[i - 1].
if (i > 1 && nums[i - 2] >= nums[i])
nums[i] = nums[i - 1]; // Remove nums[i] instead.
}
return true;
}
}
// code provided by PROGIEZ
1909. Remove One Element to Make the Array Strictly Increasing LeetCode Solution in Python
class Solution:
def canBeIncreasing(self, nums: list[int]) -> bool:
removed = False
for i in range(1, len(nums)):
if nums[i - 1] >= nums[i]:
if removed:
return False
removed = True # Remove nums[i - 1].
if i > 1 and nums[i - 2] >= nums[i]:
nums[i] = nums[i - 1] # Remove nums[i] instead.
return True
# code by PROGIEZ
Additional Resources
- Explore all LeetCode problem solutions at Progiez here
- Explore all problems on LeetCode website here
Happy Coding! Keep following PROGIEZ for more updates and solutions.