Maximum Edge on a Tree Path
Hard
Binary Lifting & LCA
A weighted tree is rooted at node 1. For each query (u, v) print the largest edge weight on the path between them (print 0 when u = v). Extend binary lifting with a max-weight table.
Constraints
1 <= n, q <= 10^5 1 <= w <= 10^9
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.