Simple Brute Force Python O(n^2)
The distance between house l and r is min(r - l, abs(x - l) + abs(r - y) + 1) (either go l -> r or l -> x -> y -> r, whichever shorter)\nThen 2 for loop brute f
The distance between house `l` and `r` is `min(r - l, abs(x - l) + abs(r - y) + 1)` (either go `l` -> `r` or `l` -> `x` -> `y` -> `r`, whichever shorter)\nThen 2 for loop brute force for each pair of houses `l` and `r`\n```\nclass Solution:\n    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:\n        x, y = min(x, y), max(x, y)\n        ans = [0]*n\n        for l in range(1, n + 1):\n            for r in range(l + 1, n + 1):\n                d = self.minDistance(l, r, x, y)\n                ans[d - 1] += 2\n        return ans\n    \n    def(self, l, r, x, y):\n        return min(r - l, abs(x - l) + abs(r - y) + 1)\n```
['Python', 'Python3']