BFS traversal for every node to maintain count with K dist
\nint bfs(int node,int k,vector<vector<int>>&adj,int n){ \n        vector<int> vis(n,0);\n        queue<int> q;\n        q.push(node);\n        vis[node]=1;\n  
```\nint bfs(int node,int k,vector<vector<int>>&adj,int n){ \n        vector<int> vis(n,0);\n        queue<int> q;\n        q.push(node);\n        vis[node]=1;\n        int cnt=0;\n        int tot=0;\n        while(!q.empty()){\n            int l=q.size();\n            if(cnt<=k){\n               tot+=l;\n            }\n            if(cnt>k){\n                return tot;\n            }\n            for(int i=0;i<l;i++){\n                int node=q.front();\n                q.pop();\n                for(auto it:adj[node]){\n                    if(vis[it]==0){\n                        vis[it]=1;\n                        q.push(it);\n                    }\n                }\n            }\n            cnt++;\n        }\n        return tot;\n\n    }\n    vector<int> maxTargetNodes(vector<vector<int>>& edges1, vector<vector<int>>& edges2, int k) {\n       int n=edges1.size();\n        int m=edges2.size();\n        vector<int> bfs1(n+1,0);\n        vector<int> ans(n+1);\n        int maxi=INT_MIN;\n        vector<vector<int>> adj1(n+1);\n        for(int i=0;i<n;i++){\n            int u=edges1[i][0];\n            int v=edges1[i][1];\n            adj1[u].push_back(v);\n            adj1[v].push_back(u);\n        }\n        vector<vector<int>> adj2(m+1);\n        for(int i=0;i<m;i++){\n            int u=edges2[i][0];\n            int v=edges2[i][1];\n            adj2[u].push_back(v);\n            adj2[v].push_back(u);\n        }\n        for(int i=0;i<n+1;i++){\n            bfs1[i]=bfs(i,k,adj1,n+1);\n        }\n\n\n        for(int i=0;i<m+1;i++){\n            maxi=max(maxi,bfs(i,k-1,adj2,m+1));\n            \n        }\n        for(int i=0;i<n+1;i++){\n            ans[i]=bfs1[i]+maxi;\n        }\n        \n        return ans;\n    }\n\t```
['Breadth-First Search', 'Graph', 'C']