https://leetcode-cn.com/problems/two-furthest-houses-with-different-colors/
class Solution: def maxDistance(self, colors: List[int]) -> int: n = len(colors) res = 0 for i in range(n): for j in range(i): if colors[i] != colors[j]: res = max(res, i-j) return res
最后更新于3年前