C++ - O(n) to build & O(1) query
\nclass FindElements {\nprivate:\n    unordered_set<int> cache;\n    \n    void recover(TreeNode *root, int prev)\n    {\n        if(!root) return;\n        \n 
```\nclass FindElements {\nprivate:\n    unordered_set<int> cache;\n    \n    void recover(TreeNode *root, int prev)\n    {\n        if(!root) return;\n        \n        root->val = prev;\n        cache.insert(root->val);\n        \n        recover(root->left, 2*prev + 1);\n        recover(root->right, 2*prev + 2);\n    }\n    \npublic:\n    FindElements(TreeNode* root) {\n        recover(root, 0);\n    }\n    \n    bool find(int target)  {\n        return cache.count(target) > 0;\n    }\n};\n\n```
['C']