/*
二叉树层次遍历
*/
class Solution {
public:
        vector<vector<int> > Print(TreeNode* pRoot) {
            vector<vector<int> > ans;
            if(!pRoot) return ans;
            queue<TreeNode*> q;
            q.push(pRoot);
            while(!q.empty()){
                int size = q.size();
                vector<int> res;
                while(size--){
                    TreeNode *tmp = q.front();
                    q.pop();
                    res.push_back(tmp->val);
                    if(tmp->left)q.push(tmp->left);
                    if(tmp->right)q.push(tmp->right);
                }
                ans.push_back(res);
            }
            return ans;
        }

};