[LeetCode] Count the Number of Houses at a Certain Distance I

1 · · Jan. 21, 2024, 5:39 a.m.
3015. Count the Number of Houses at a Certain Distance I You are given three positive integers n, x, and y. In a city, there exist houses numbered 1 to n connected by n streets. There is a street connecting the house numbered i with the house numbered i + 1 for all 1 <= i <= n - 1 . An additional street connects the house numbered x with the house numbered y. For each k, such that 1 <= k <= n, you need to find the number of pairs of houses (house1, house2) such that the minimum number of street...