Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given a 0-indexed integer array nums. In one operation, you can:

Choose an index i in the range 0 <= i < nums.length
Set nums[i] to nums[i] + 1 or nums[i] - 1

Return the minimum number of operations to make nums non-decreasing or non-increasing.
 
Please complete the following python code precisely:
```python
class Solution:
    def convertArray(self, nums: List[int]) -> int:
```