Java simple DFS and Set
\nclass FindElements {\n    Set<Integer> st = new HashSet<>();\n    public FindElements(TreeNode root) {\n        if (root == null) return;\n        dfs(root, 0
```\nclass FindElements {\n    Set<Integer> st = new HashSet<>();\n    public FindElements(TreeNode root) {\n        if (root == null) return;\n        dfs(root, 0);\n    }\n    \n    private void dfs(TreeNode node, int val) {\n        st.add(val);\n        if (node.left != null) dfs(node.left, val * 2 + 1);\n        if (node.right != null) dfs(node.right, val * 2 + 2);\n    }\n    \n    public boolean find(int target) {\n        return st.contains(target);\n    }\n}\n```
[]