C++ solution using only one queue / use a marker NULL
class Solution {\n    public:\n        vector<vector<int> > levelOrder(TreeNode *root) {\n            vector<vector<int> >  result;\n            if (!root) retu
    class Solution {\n    public:\n        vector<vector<int> > levelOrder(TreeNode *root) {\n            vector<vector<int> >  result;\n            if (!root) return result;\n            queue<TreeNode*> q;\n            q.push(root);\n            q.push(NULL);\n            vector<int> cur_vec;\n            while(!q.empty()) {\n                TreeNode* t = q.front();\n                q.pop();\n                if (t==NULL) {\n                    result.push_back(cur_vec);\n                    cur_vec.resize(0);\n                    if (q.size() > 0) {\n                        q.push(NULL);\n                    }\n                } else {\n                    cur_vec.push_back(t->val);\n                    if (t->left) q.push(t->left);\n                    if (t->right) q.push(t->right);\n                }\n            }\n            return result;\n        }\n    };
['C++']