Google L3 | Interview

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-10-01Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown

given a binary tree, with each edge having a cost associated. we want to cut the edges in such a way that all the leaf nodes get disconnected. find the min cost.
eg.
6
/ \\
4 2
/
1
cost of 6-4 = 5, 6-2 = 1, 4-1 = 10 then ans should be 5 + 1 = 6

how to solve this?
Comments