DFS From every Node
Intuition\n Describe your first thoughts on how to solve this problem. \nFind Max Possible DFS in Tree2 with k-1 which will be inturn added to DFS of each node 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFind Max Possible DFS in Tree2 with k-1 which will be inturn added to DFS of each node in Tree1.\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int dfs(int i, int p, vector<vector<int>> &al, int k) {\n    if (k <= 0)\n        return k == 0;\n    int res = 1;\n    for (int j : al[i])\n        if (j != p)\n            res += dfs(j, i, al, k - 1);\n    return res;\n}\n\nvector<vector<int>> adjacencyList(vector<vector<int>>& edges) {\nvector<vector<int>> al(edges.size() + 1);\nfor (auto &e: edges) {\n    al[e[0]].push_back(e[1]);\n    al[e[1]].push_back(e[0]);            \n}        \nreturn al;\n}\n\n    vector<int> maxTargetNodes(vector<vector<int>>& e1, vector<vector<int>>& e2, int k) {\n     int m = e1.size() + 1, n = e2.size() + 1, max2 = 0;\n    auto al1 = adjacencyList(e1), al2 = adjacencyList(e2);\n    vector<int> res(m);  \n    for(int i=0;i<n;i++)\n    {\n        max2=max(max2,dfs(i,-1,al2,k-1));\n    } \n\n    for(int i=0;i<m;i++)\n    {\n        res[i]=dfs(i,-1,al1,k)+max2;\n    }\n    return res;\n\n    }\n};\n```
['C++']