easy understading and memory efficient solution in js
```\nvar FindElements = function(root) {\n    this.tree = root\n};\n\n/ \n * @param {number} target\n * @return {boolean}\n /\nFindElements.prototype.find = fun
```\nvar FindElements = function(root) {\n    this.tree = root\n};\n\n/** \n * @param {number} target\n * @return {boolean}\n */\nFindElements.prototype.find = function(target) {\n    this.tree.val = 0;\n    function find(target,root){\n        if(!root) return false;\n        let val = root.val\n        if(val === target) return true;\n        if(root.left) {\n            root.left.val = 2*val +1;\n            if(find(target,root.left)) return true\n        }\n        if(root.right) {\n            root.right.val = 2*val +2;\n            if(find(target,root.right))return true\n        }\n        return false\n    }\n     return find(target,this.tree)\n    \n};
['Tree', 'JavaScript']