We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Great hints! It is actually possible to do this only traversing the graph once (one DFS). Hint: try at the beginning, calculating half of the total weight of the tree. Keep a running minimum as you traverse the tree....
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the Tree
You are viewing a single comment's thread. Return to all comments →
Great hints! It is actually possible to do this only traversing the graph once (one DFS). Hint: try at the beginning, calculating half of the total weight of the tree. Keep a running minimum as you traverse the tree....