New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
TikTok
Coding Question
AI Insights
Quick Summary
Balance all root-to-leaf path latencies in a perfect binary tree by only increasing edge weights.
Minimize the total additional latency added across all edges to achieve uniform leaf depth.
The tree structure is implicitly defined using standard binary heap indexing rules.
What This Tests
Post-order tree traversal
Greedy subtree balancing
Recursive state accumulation
Implicit array-to-tree mapping
Common Patterns
DFS/BFS
Greedy
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Accepted
2.2k
/4k
Acceptance Rate
54.3%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
n =
latency =
Output
Expected