🚀 Easy | Tree | Set | Map | JavaScript Solution
Approach / Intuition:

Recovering the Tree:

We traverse the tree in a preorder fashion (Root → Left → Right).
We update each node's value based on its parent's
## Approach / Intuition:
1. **Recovering the Tree:**  
   - We traverse the tree in a preorder fashion (Root → Left → Right).
   - We update each node's value based on its parent's value.
   - We store the recovered values in a `Set` (`this.indices`) for quick lookup in `O(1)` time.  

2. **Finding a Target Value:**  
   - Since we stored all recovered values in a `Set`, we can check if a target value exists in `O(1)` time using `.has(target)`.  

⬆️ Upvote, if you understand the approach.

## Complexity
- **Time complexity: O(n)** . Because, we are visiting each node once.
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- **Space complexity: O(n)** . Because, we are storing `n` elements in the set.
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

## Code
```javascript []
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 */
var FindElements = function (root) {

    this.indices = new Set();   // Using this extra space for faster lookup : O(1)

    this.root = this.recover(root, 0);
};

FindElements.prototype.recover = function (root, index) {

    // Base case: Don't proceed if the root is null
    if (!root) {
        return null;
    }

    this.indices.add(index);
    root.val = index;   // [optional] Update the values of tree
    this.recover(root.left, (2 * index) + 1);
    this.recover(root.right, (2 * index) + 2);
    return root;
}

/** 
 * @param {number} target
 * @return {boolean}
 */
FindElements.prototype.find = function (target) {
    
    return this.indices.has(target);
};

/** 
 * Your FindElements object will be instantiated and called as such:
 * var obj = new FindElements(root)
 * var param_1 = obj.find(target)
 */
```
['Hash Table', 'Tree', 'Binary Tree', 'Ordered Set', 'JavaScript']