C++ solutions
\nclass Solution {\npublic:\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        if (!root) { return {}; }\n        vector<int> row;\n        vector<v
```\nclass Solution {\npublic:\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        if (!root) { return {}; }\n        vector<int> row;\n        vector<vector<int> > result;\n        queue<TreeNode*> q;\n        q.push(root);\n        int count = 1;\n\t\t\n\t\twhile (!q.empty()) {\n            if (q.front()->left) { q.push(q.front()->left); }\n            if (q.front()->right) { q.push(q.front()->right); }\n            row.push_back(q.front()->val), q.pop();\n            if (--count == 0) {\n                result.emplace_back(row), row.clear();\n                count = q.size();\n            }\n        }\n        return result;\n    }\n};\n```
['C', 'C++']