Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.22 KB

_1909. Remove One Element to Make the Array Strictly Increasing.md

File metadata and controls

56 lines (44 loc) · 1.22 KB

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 17, 2024

Last updated : June 17, 2024


Related Topics : Array

Acceptance Rate : 28.32 %


Solutions

C

bool canBeIncreasing(int* nums, int numsSize) {
    for (int i = 0; i < numsSize; i++) { // val to ignore
        bool increasing = true;
        int j = 0;
        for (j; j < numsSize - 1; j++) {
            if (j == i) {
                continue;
            }
            int compare = j + 1;
            if (compare == i) {
                compare++;
            }
            if (compare >= numsSize) {
                continue;
            }

            if (nums[j] >= nums[compare]) {
                increasing = false;
                break;
            }
        }

        if (increasing) {
            return true;
        }
    }
    return false;
}