W
Webcoderspeed
BlogTagsProjectsAbout
W
webcoderspeed
HomeBlogTagsProjectsAbout

webcoderspeed.com

Rerooting

1 articles

Filter by topic

  • All Posts
  • dsa780
  • interview684
  • medium348
  • backend198
  • arrays153
  • nodejs147
  • google140
  • amazon127
  • strings126
  • system-design126
  • hard120
  • dfs113
  • sliding-window108
  • easy106
  • bfs103
  • two-pointers98
  • greedy76
  • architecture71
  • stack71
  • devops70
  • binary-search70
  • graphs67
  • reliability67
  • hash-map61
  • typescript60
  • design59
  • ai57
  • trees54
  • performance54
  • dynamic-programming53
dsa3 min read

Sum of Distances in Tree

Compute sum of distances from every node to all others in O(n) using two DFS passes with rerooting technique.

March 19, 2026Read →
W
webcoderspeed

Deep technical content for engineers who want to build better systems. System design, AI, backend patterns, and more.

twittergithubyoutubelinkedinmail

Topics

  • System Design
  • AI & Machine Learning
  • Backend Engineering
  • TypeScript & Node.js
  • Databases
  • Cloud & DevOps
  • Security

Navigation

  • Blog
  • Tags
  • Projects
  • About
  • RSS Feed
© 2026 webcoderspeed. All rights reserved.Built with Next.js · Deployed on Vercel