DFS + Set/Map Solution - Easy_Beginner-Friendly Sol.
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []

class FindElements {
public:
    unordered_map<int, bool> values; 

    void recover(TreeNode* root, int val) {
        if (!root) return;
        root->val = val;
        values[val] = true;  
        recover(root->left, 2 * val + 1);
        recover(root->right, 2 * val + 2);
    }

    FindElements(TreeNode* root) {
        if (root) {
            recover(root, 0);
        }
    }
    
    bool find(int target) {
        return values.find(target) != values.end();
    }
};

```
['Hash Table', 'Tree', 'Breadth-First Search', 'Design', 'Binary Tree', 'Ordered Set', 'C++']