simple JAVA DSF solution use BitSet,double 100%
\n    class FindElements {\n\n        private BitSet sets = new BitSet();\n\n        public FindElements(TreeNode root) {\n            dsf(root, 0);\n        }\
```\n    class FindElements {\n\n        private BitSet sets = new BitSet();\n\n        public FindElements(TreeNode root) {\n            dsf(root, 0);\n        }\n\n        public boolean find(int target) {\n            return sets.get(target);\n        }\n\n        private void dsf(TreeNode root, int val) {\n            if (root == null) return;\n            sets.set(val);\n            dsf(root.left, 2 * val + 1);\n            dsf(root.right, 2 * val + 2);\n        }\n    }\n\n```
[]