First, find a pair where the order is wrong. Then there are two possibilities, either the first in the pair can be modified or the second can be modified to create a valid sequence. We simply modify both of them and check for validity of the modified arrays by comparing with the array after sorting.

I find this approach the easiest to reason about and understand.

*By Yang Shun*

```
class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
one, two = nums[:], nums[:]
for i in range(len(nums) - 1):
if nums[i] > nums[i + 1]:
one[i] = nums[i + 1]
two[i + 1] = nums[i]
break
return one == sorted(one) or two == sorted(two)
```

Thanks to @xiaoyudeng666 for the tip (: