BFS Traversal || SImple Solution || O(N) Time Complexity || CPP
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```cpp []
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class FindElements {
public:
    map<int,bool>m;
    FindElements(TreeNode* root) {
        queue<TreeNode*>q;
        
        m[0]=true;
        root->val=0;
        q.push(root);
        while(!q.empty()){
            auto front =q.front();
            m[front->val]=true;
            q.pop();
            if(front->left!=NULL){front->left->val=2*front->val+1;q.push(front->left);}
            if(front->right!=NULL){front->right->val=2*front->val+2;q.push(front->right);}

        }
        
    }
    
    bool find(int target) {
        if(m[target]) return true;
        return false;
        
    }
};

/**
 * Your FindElements object will be instantiated and called as such:
 * FindElements* obj = new FindElements(root);
 * bool param_1 = obj->find(target);
 */
```
['C++']