题目描述
Given a special binary tree having random pointers along with the usual left and right pointers. Clone the given tree.
Example 1:
Input:
Output: 1
Explanation: The tree was cloned successfully.
Your Task:
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).
Constraints:
1 ≤ Number of nodes ≤ 100
1 ≤ Data of a node ≤ 1000
输入格式
见题面
输出格式
见题面
样例输出
1