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

There are n houses evenly lined up on the street, and each house is beautifully painted. You are given a 0-indexed integer array colors of length n, where colors[i] represents the color of the ith house.
Return the maximum distance between two houses with different colors.
The distance between the ith and jth houses is abs(i - j), where abs(x) is the absolute value of x.
 
Please complete the following python code precisely:
```python
class Solution:
    def maxDistance(self, colors: List[int]) -> int:
```