radhe radhe || simple and easy solution || beats 100%
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```\nclass Solution {\npublic:\n    vector<int> find(int srt,int n,vector<int> adj[]){\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;\n        vector<int> dist(n+1,INT_MAX);\n        pq.push({0,srt});\n        dist[srt]=0;\n        while(!pq.empty()){\n            int dis=pq.top().first;\n            int node=pq.top().second;\n            pq.pop();\n            for(auto nbr:adj[node]){\n                if(dis+1<dist[nbr]){\n                    dist[nbr]=1+dis;\n                    pq.push({dist[nbr],nbr});\n                }\n            }\n        }\n        return dist;\n    }\n    vector<int> countOfPairs(int n, int x, int y) {\n        vector<int> adj[n+1];\n        for(int i=1;i<=n;i++){\n            if(i==n)continue;\n            adj[i].push_back(i+1);\n            adj[i+1].push_back(i);\n        }\n        adj[x].push_back(y);\n        adj[y].push_back(x);\n\n        vector<int> dist[n+1];\n        for(int i=1;i<=n;i++){\n            dist[i]=find(i,n,adj);\n        }\n\n        vector<int> ans;\n        for(int k=1;k<=n;k++){\n            int cnt=0;\n            for(int i=1;i<=n;i++){\n                for(int j=1;j<=n;j++){\n                    if(dist[i][j]==k)cnt++;\n                }\n            }\n            ans.push_back(cnt);\n        }\n\n        return ans;\n    }\n};\n```
['C++']