Company: MediaNet_8oct
Difficulty: medium
Fruits on Tree Problem Description Given a complete rooted tree with N nodes numbered 1 to N. This tree has its leaves at the top and root at the bottom. A complete tree is a tree which has all its leaf at the same level. There are some fruits on every leaf of the tree and in order to get all the fruits you have to shake the tree any number of times. But this tree is a little different than the rest it has following properties: Every node has its capacity value that represents the number of fruits a node can hold at any moment. Only one fruit Falls from each node to its parent node in one Shake. If a number of fruits at a node is more than its Capacity then excess fruits(greater than Capacity) on that node at that instant will fall to the ground. This process happens instantly, no shake required. The tree is rooted at 1. You may assume that root is one level above ground so all fruits which fall from root lands on the ground. You have to find the minimum number of shakes you have to pe