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

You are given an integer array nums. The range of a subarray of nums is the difference between the largest and smallest element in the subarray.
Return the sum of all subarray ranges of nums.
A subarray is a contiguous non-empty sequence of elements within an array.
 
Please complete the following python code precisely:
```python
class Solution:
    def subArrayRanges(self, nums: List[int]) -> int:
```