Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HarshKumarChoudary/9b5313fd5079e6c2038bf3dfeee9a505 to your computer and use it in GitHub Desktop.
Save HarshKumarChoudary/9b5313fd5079e6c2038bf3dfeee9a505 to your computer and use it in GitHub Desktop.
ll cnt =0;
ll dfs(ll i,ll pre,vector<ll>&a,vector<vector<ll>>&edges,ll val){
ll cur = a[i];
for(auto x:edges[i]){
if(x==pre)
continue;
cur^=dfs(x,i,a,edges,val);
}
if(cur==val)
++cnt,cur = 0;
return cur;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment