class Solution:

    def checkPossibility(self, nums: List[int]) ->bool:
        prepre = -10 ** 5
        pre = 'not'
        count = 0
        for idx, num in enumerate(nums):
            if pre == 'not':
                pre = num
            else:
                if pre > num:
                    if prepre <= num:
                        pre = prepre
                    else:
                        nums[idx] = pre
                    count += 1
                    if count > 1:
                        return False
                prepre, pre = pre, nums[idx]
        return True

49f657d6b48a76df5118d78eddf819b2c459a71d
<mask token>

class Solution:
    <mask token>

class Solution:

    def checkPossibility(self, nums: List[int]) ->bool:
        prepre = -10 ** 5
        pre = 'not'
        count = 0
        for idx, num in enumerate(nums):
            if pre == 'not':
                pre = num
            else:
                if pre > num:
                    if prepre <= num:
                        pre = prepre
                    else:
                        nums[idx] = pre
                    count += 1
                    if count > 1:
                        return False
                prepre, pre = pre, nums[idx]
        return True
