Given a binary tree and a budget. Assume you are at the root of the tree, you need to maximise the count of leaf nodes you can visit in your budget if you have to pay particular cost every time you visit a new node in the Tree ( you have to pay cost to visit leaf node also). Your task is to complete the function getCount().
The function takes two arguments as input, the reference pointer to the root of the binary tree and a variable budget denoting the budget provided to you.
There will be T test cases and for each test case the function will be called separately.
For each test case output the total of number of the leaf nodes you can visit in the provided budget.
10 8 L 8 3 L 10 2 R 2 3 L 3 4 R 2 6 R
Binary Tree is as:
/ / \
3 3 6
Cost For visiting Leaf Node 3: 3
Cost For visiting Leaf Node 4: 4
Cost For visiting Leaf Node 6: 3
In budget one can Max 2 Leaf Nodes.
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.