JAVA_LeetCode 1909_Remove One Element to Make the Array Strictly Increasing 풀이 class Solution { public boolean canBeIncreasing(int[] nums) { int cnt = 0; // 현 요소값이 이전 요소값보다 작은 경우 2번째 이전 요소값과 비교한다. // 만약 같거나 크다면 이전 요소값을 초기화해준다. >> cnt가 2 이상이 된다. for (int i = 1; i < nums.length; i++) { if (nums[i] <= nums[i - 1]) { cnt++; if (i > 1 && nums[i] <= nums[i - 2]) { nums[i] = nums[i - 1]; } } } return cnt <= 1; } } * 출처 https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasi...
#
JAVA
#
JAVA_LeetCode1909
#
JAVA_LeetCode1909_RemoveOneElementtoMaketheArrayStrictlyIncreasing
#
JAVA_RemoveOneElementtoMaketheArrayStrictlyIncreasing
#
LeetCode1909_RemoveOneElementtoMaketheArrayStrictlyIncreasing