java.lang.Object
g1901_2000.s1909_remove_one_element_to_make_the_array_strictly_increasing.Solution

public class Solution extends Object
1909 - Remove One Element to Make the Array Strictly Increasing.<p>Easy</p> <p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, return <code>true</code> <em>if it can be made <strong>strictly increasing</strong> after removing <strong>exactly one</strong> element, or</em> <code>false</code> <em>otherwise. If the array is already strictly increasing, return</em> <code>true</code>.</p> <p>The array <code>nums</code> is <strong>strictly increasing</strong> if <code>nums[i - 1] < nums[i]</code> for each index <code>(1 <= i < nums.length).</code></p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> nums = [1,2,10,5,7]</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> By removing 10 at index 2 from nums, it becomes [1,2,5,7]. [1,2,5,7] is strictly increasing, so return true.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> nums = [2,3,1,2]</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong></p> <p>[3,1,2] is the result of removing the element at index 0.</p> <p>[2,1,2] is the result of removing the element at index 1.</p> <p>[2,3,2] is the result of removing the element at index 2.</p> <p>[2,3,1] is the result of removing the element at index 3.</p> <p>No resulting array is strictly increasing, so return false.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> nums = [1,1,1]</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> The result of removing any element is [1,1]. [1,1] is not strictly increasing, so return false.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>2 <= nums.length <= 1000</code></li> <li><code>1 <= nums[i] <= 1000</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • canBeIncreasing

      public boolean canBeIncreasing(int[] nums)