[Python-Study Leetcode 문제풀이] 665. Non-decreasing Array
Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] [4, 2, 1]의 경우, 2개 이상의 수를 변경해야 하므로, Fail [Solution Code] [1, 2, 3, 4, 5, 6, 4] 라는 배열이 있다고 가정하자 그러면, 각 숫자의 차이값을 계산한다면 [1, 2, 3, 4, 5, 6, 5] ↓ [1, 1, 1, 1, 1, -1] 이라는 배열을 얻을 수 있다. 1) 이때, 모든 배열의 값이 0보다 크거나 같다면, 해당 배열은 모두 증가하는 추세이..
2021. 3. 17.