Given a binary tree with the following rules:
Now the binary tree is contaminated, which means all treeNode.val have been changed to -1.
Implement the FindElements class:
The height of the binary tree is less than or equal to 20
The total number of nodes is between [1, 104]
Total calls of find() is between [1, 104]
0 <= target <= 106
1261. Find Elements in a Contaminated Binary Tree
Medium
30 Points
Hash Table
Tree
Depth-First Search
Breadth-First Search
Design
Binary Tree
Given a binary tree with the following rules:
Now the binary tree is contaminated, which means all treeNode.val have been changed to -1.
Implement the FindElements class: