Please share your dfs with lambda function code or improve mine.
function<void()> dfs = [&](int a, int par, int depth) {
vis[a] = true;
if(depth > maxDepth){
maxDepth = depth;
farthestNode = a;
}
for(auto x: adj[a]){
if(!vis[x])
dfs(x, a, 1 + dep);
}
};
I get the following error. error: no match for call to '(std::function<void()>) (long long int&, long long int&, long long int)'|
NOTE: changing a to &a and p to &p in parameter list does not make the error go away.