✅ C++ | |BFS || Easy to understand
\nclass Solution {\npublic:\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        \n        vector<vector<int>> ans;\n        if(root == NULL ) return 
```\nclass Solution {\npublic:\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        \n        vector<vector<int>> ans;\n        if(root == NULL ) return ans;\n        queue<TreeNode*> q;\n        q.push(root);\n        while(!q.empty())\n        {\n            int size = q.size();\n            vector<int> level;\n            for(int i=0;i<size;i++)\n            {\n                TreeNode *node = q.front();\n                q.pop();\n                if(node->left != NULL) q.push(node->left);\n                if(node->right != NULL) q.push(node->right);\n                level.push_back(node->val);\n            }\n            ans.push_back(level);\n        }\n        return ans;\n    }\n};\n```\n**Don\'t forget to Upvote the post, if it\'s been any help to you**
['Tree', 'Breadth-First Search', 'C']