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

1 · · Jan. 21, 2024, 5:39 a.m.
3017. Count the Number of Houses at a Certain Distance II 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 stree...