Here is my Python solution

class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
cnt = 0
for i in range(1, len(nums)):
if cnt > 1: return False
# use 1,2,3 to denote i-2 i-1 i, 1 largest
if nums[i-1] > nums[i]:
cnt += 1
if i < 2 or nums[i-2] <= nums[i]:
# from 3 1 2 to 3 2 2
nums[i-1] = nums[i]
else:
# from 2 1 3 to 2 1 1
nums[i] = nums[i-1]
return cnt <= 1