🔥 Space: O(log n) | Time: O(log n) 🚀💯 Beats 99% in both Space & Time ⚡🏆 Unique Bitmask 
IntuitionBeacause of the fixed way of numbering in the binary tree, there is a unique identifier for each node, represented by the value of it :-These numbers a
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Beacause of the fixed way of numbering in the binary tree, there is a unique identifier for each node, represented by the value of it :-

            1
          /   \
         2     3
        /  \
       4   5

These numbers are the values for the node as well as their unique address. 

Therefore we don't even need to recover the tree since we can consider the target number as pointer and just check if any node is present there. (Doesn't matter if the node value is -1 there, only node existence is important rather than the value)
-

# Approach
<!-- Describe your approach to solving the problem. -->
Suppose the root node is 1. -->

To check existence of a node, calculate its binary representation string.From second index, traverse the string from left to right , and in the tree ,move left if you encounter a '0' in string, else move right(on encountering '1').
-- eg:- suppose you want to check if node number 12 exists.
-- its binary string :- "1100"
-- Initialize TreeNode temp = root;
-- Index 0 -> "1" , ignore 1st position
-- Index 1 -> "1" , move right in tree (temp = temp.right)
-- Index 2 -> "0" , move left in tree (temp = temp.left)
-- Index 3 -> "0" , check if (node.left) exists, if yes then node number 12 exists.

Now,since this approach is based on the assumption that root node value is 1, we simply add one to the target value to be found to convert the problem exactly to match this approach.
-

# Complexity
- Time complexity: O(log n) ,for find() method. Overall :- O(n*log n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(log n) overall.
    The only extra space used is for storing the binary string representation of target + 1, which has at most O(log target) characters.

<!-- Add your space complexity here, e.g. $$O(n)$$ -->


# Code
```java []
class FindElements {

    TreeNode base;

    public FindElements(TreeNode root) {
        base = root;
    }
    
    public boolean find(int target) {
        String mask = Integer.toBinaryString(target+1);
        TreeNode temp = base;
        for(int i = 1;i<mask.length();i++){
            if(mask.charAt(i) == '1'){
                if(temp.right == null){
                    return false;
                }
                temp = temp.right;
            }
            else{
                if(temp.left == null){
                    return false;
                }
                temp = temp.left;
            }
        }
        return true;
        
    }
}
```
['String', 'Binary Tree', 'Bitmask', 'Java']