Notes
This function is in beta test. Please help improve it in the issues
here.
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, you will still get Wrong Answer because the complete output may be longer and there might be errors in the future lines.
Please double check your code to solve this problem and try again.
Your Answer
Entering BinaryTree Entering BinaryTree val = 0 Entering BinaryTree val = 1 Entering BinaryTree Entering copy Entering copy root is nullptr Entering copy root is nullptr newNode->val = 0 Entering copy root is nullptr val = 1 left.root = 0x557341503220 right.root = 0 Entering ~BinaryTree Entering removeAll root->val = 0 Entering removeAll root is nullptr Entering removeAll root is nullptr Entering ~BinaryTree Entering removeAll root is nullptr Entering BinaryTree Entering BinaryTree val = 2 Entering BinaryTree val = 3 Entering BinaryTree Entering copy Entering copy root is nullptr Entering copy root is nullptr newNode->val = 2 Entering copy root is nullptr val = 3 left.root = 0x557341503220 right.root = 0 Entering ~BinaryTree Entering removeAll root->val = 2 Entering removeAll root is nullptr Entering removeAll root is nullptr Entering ~BinaryTree Entering removeAll root is nullptr Entering BinaryTree val = 2 Entering BinaryTree Entering copy Entering copy Entering copy root is nullptr Entering copy root is nu
JOJ Answer
Test 5: The sum of the tree is 8