Given a special binary tree having random pointers along with the usual left and right pointers. Clone the given tree.
Input: Output: 1 Explanation: The tree was cloned successfully.
No need to read input or print anything. Complete the function cloneTree() which takes root of the given tree as input parameter and returns the root of the cloned tree.
Note: The output is 1 if the tree is cloned successfully. Otherwise output is 0.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
1 <=Number of nodes<= 100
1 <=Data of a node<= 1000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes