---
# System prepended metadata

title: 1909. Remove One Element to Make the Array Strictly Increasing
tags: [Leetcode, Easy]

---

# 1909. Remove One Element to Make the Array Strictly Increasing
###### tags: `Leetcode` `Easy`
Link: https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing/description/
## 思路
思路参考[这里](https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing/solutions/1299306/two-conditions/)
如果发现有异常值(nums[i-1]>=nums[i])说明肯定要从nums[i]和nums[i-1]里面删掉一个
问题是删掉哪一个
如果nums[i-2]>=nums[i] 说明肯定要删掉nums[i] 为了方便我们可以把nums[i]替换成nums[i-1]
## Code
```java=
class Solution {
    public boolean canBeIncreasing(int[] nums) {
        int cnt = 0;
        for(int i=0; i<nums.length; i++){
            if(i>0 && nums[i-1]>=nums[i]) cnt++;
            if(i>1 && nums[i-2]>=nums[i]) nums[i] = nums[i-1];
            if(cnt>1) return false;
        }
        return true;
    }
}
```