Java solution 2 for loops
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {\n        int[] result = new int[n];\n        int houseLeft = Math.min(x, y);\n        int houseRight = Math.max(x, y);\n\n        for (int i = 1; i <= n; i++) {\n            for (int j = i+1; j <= n; j++) {\n                int iToHouseLeft = Math.abs(houseLeft - i);\n                int jToHouseRight = Math.abs(houseRight - j);\n                // compare the num of houses using standard route vs shortcut\n                int numOfHouses = Math.min(j-i, iToHouseLeft+1+jToHouseRight);\n                // array starts at index 0 therefore minus 1\n                result[numOfHouses-1]+=2;\n            }\n        }\n        return result;\n    }\n}\n```
['Java']