Skip to content

Instantly share code, notes, and snippets.

@ishtiaqhimel
Created January 3, 2021 19:40
int dfs(int u)
{
int &res = dp[u];
if(res) return res;
res = 1;
for(auto ch : st[u].Next) {
int v = ch.second;
res += dfs(v);
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment