------
## 最终结论
```python
def maxWidthRamp(A):
    stack = []
    max_width = 0

    for i in range(len(A)):
        if not stack or A[stack[-1]] > A[i]:
            stack.append(i)

    for j in range(len(A) - 1, -1, -1):
        while stack and A[stack[-1]] <= A[j]:
            max_width = max(max_width, j - stack.pop())

    return max_width

# Example usage:
print(maxWidthRamp([6,0,8,2,1,5])) # Output: 4
print(maxWidthRamp([9,8,1,0,1,9,4,0,4,1])) # Output: 7
```