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.
- Prepare
- Algorithms
- Search
- Cut the Tree
- Discussions
Cut the Tree
Cut the Tree
Sort by
recency
|
156 Discussions
|
Please Login in order to post a comment
I try to solve this problem (in Java) without using object Node. I spent 70% time to make algorithm and last 30% time to deal with the issue that the input is not like what i assumed. I passed 6 cases and failed the others with time limitation. The code must be wrong somewhere. :((( (My English was bad)
VoIP phone service offer advance feature that faster your business and connected people all over the world.Onecloud network increases the growth of your business and proved effectively all over the worldVoIP phone service offer advance feature that faster your business and connected people all over the world.Onecloud network increases the growth of your business and proved effectively all over the world
Simple C++ Solution:
Concept: find subtree sum and calculate the min of : abs( (total_sum - subtree_sum_i) - subtree_sum_i)
Warning: Do not use recursive to solve. In Python, DFS on the graph may cause "max recursive depth exceed" error. (In Python the max depth is 1000, typically)
Here is my solution in java, javascript, python, C, C++, C Sharp HackerRank Count Luck Problem Solution