1909. Remove One Element to Make the Array Strictly Increasing Easy
1/**
2 * [1909] Remove One Element to Make the Array Strictly Increasing
3 *
4 * 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.
5 * The array nums is strictly increasing if nums[i - 1] < nums[i] for each index (1 <= i < nums.length).
6 *
7 * Example 1:
8 *
9 * Input: nums = [1,2,<u>10</u>,5,7]
10 * Output: true
11 * Explanation: By removing 10 at index 2 from nums, it becomes [1,2,5,7].
12 * [1,2,5,7] is strictly increasing, so return true.
13 *
14 * Example 2:
15 *
16 * Input: nums = [2,3,1,2]
17 * Output: false
18 * Explanation:
19 * [3,1,2] is the result of removing the element at index 0.
20 * [2,1,2] is the result of removing the element at index 1.
21 * [2,3,2] is the result of removing the element at index 2.
22 * [2,3,1] is the result of removing the element at index 3.
23 * No resulting array is strictly increasing, so return false.
24 * Example 3:
25 *
26 * Input: nums = [1,1,1]
27 * Output: false
28 * Explanation: The result of removing any element is [1,1].
29 * [1,1] is not strictly increasing, so return false.
30 *
31 *
32 * Constraints:
33 *
34 * 2 <= nums.length <= 1000
35 * 1 <= nums[i] <= 1000
36 *
37 */
38pub struct Solution {}
39
40// problem: https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing/
41// discuss: https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing/discuss/?currentPage=1&orderBy=most_votes&query=
42
43// submission codes start here
44
45impl Solution {
46 pub fn can_be_increasing(nums: Vec<i32>) -> bool {
47 false
48 }
49}
50
51// submission codes end
52
53#[cfg(test)]
54mod tests {
55 use super::*;
56
57 #[test]
58 fn test_1909() {
59 }
60}
61
Back
© 2025 bowen.ge All Rights Reserved.