Skip to content

Instantly share code, notes, and snippets.

@lsiddiqsunny
Last active September 7, 2017 14:53
Show Gist options
  • Save lsiddiqsunny/b393d75da09792f1e514b1d03e0bda9f to your computer and use it in GitHub Desktop.
Save lsiddiqsunny/b393d75da09792f1e514b1d03e0bda9f to your computer and use it in GitHub Desktop.
for(int i=1;i<=n;i++)
{
memset(visited,0,sizeof visited);
dfs(i);
for(int j=1;j<=n;j++)
if(visited[j]==1)
ans[i]=ans[i]+cost[j];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment