vector<int> Solution::solve(TreeNode* A, int B) {
    vector<int> v;
    queue<TreeNode *> q;
    q.push(A);
    bool m=true;
    while(!q.empty() && m){
        int n=q.size();
        for(int i=0;i<n;i++){
            TreeNode *t=q.front();
            q.pop();
            if( (t->left   && t->left->val== B) || (t->right && t->right->val==B))
 m=false;
            else {
            if(t->left) q.push(t->left);
            if(t->right) q.push(t->right);
            }
        }
    }
    while(!q.empty()){
        v.push_back(q.front()->val);
        q.pop();
    }
    return v;
}
region:us
{}
TAGS
#region-us 

vector<int> Solution::solve(TreeNode* A, int B) {
    vector<int> v;
    queue<TreeNode *> q;
    q.push(A);
    bool m=true;
    while(!q.empty() && m){
        int n=q.size();
        for(int i=0;i<n;i++){
            TreeNode *t=q.front();
            q.pop();
            if( (t->left   && t->left->val== B) || (t->right && t->right->val==B))
 m=false;
            else {
            if(t->left) q.push(t->left);
            if(t->right) q.push(t->right);
            }
        }
    }
    while(!q.empty()){
        v.push_back(q.front()->val);
        q.pop();
    }
    return v;
}
TAGS
#region-us 

passage: TAGS
#region-us 
