Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3515. Shortest Path in a Weighted Tree
Maintain distances from root in a rooted weighted tree under two operations: update the weight of a single edge and query the shortest-path distance from the root to a given node. Key insight — changing an edge weight adds a constant delta to all nodes in the edge's child subtree, so you need a data structure that supports many subtree range-updates and point-distance queries efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.