Problem with this?


#1

Comment body goes here.vector Solution::solve(TreeNode* A) {
queue<TreeNode*> q;
vector v;
if(A==NULL) return v;
q.push(A);
q.push(NULL);

while(!q.empty())
{
    TreeNode* temp = q.front();
    q.pop();
    
    if(q.front()==NULL) 
        v.push_back(temp->val);
    if(temp==NULL) 
        q.push(NULL);
    if(temp->left) q.push(temp->left);
    if(temp->right) q.push(temp->right);
}

return v;

}