Given a binary tree A with N nodes.
You have to remove all the half nodes and return the final binary tree.
1 <= N <= 105
First and only argument is an pointer to the root of binary tree A.
Return a pointer to the root of the new binary tree.
1 / \ 2 3 / 4
1 / \ 2 3 / \ \ 4 5 6
1 / \ 4 3
1 / \ 2 6 / \
The only half node present in the tree is 2 so we will remove this node.
The only half node present in the tree is 3 so we will remove this node.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.