Search
⌘K

Leetcode 3585. Find Weighted Median Node in Tree

Given a weighted tree and many queries (u, v), find the first node along the path from u to v where the cumulative edge weight from u reaches at least half the total path weight; this requires fast path-weight prefix queries using preprocessing (distances + LCA) and jump operations (e.g., binary lifting or HLD) to locate the median node efficiently.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.