Share my iterative solution using C++\uff0ceasy to understand
class Solution {\n    public:\n        vector<vector<int>> levelOrder(TreeNode* root) {\n            vector<vector<int>> ret;\n            TreeNode *temp = NULL
    class Solution {\n    public:\n        vector<vector<int>> levelOrder(TreeNode* root) {\n            vector<vector<int>> ret;\n            TreeNode *temp = NULL;\n            int curLevelCount = 0;\n            if (root == NULL) return ret;\n            \n            queue<TreeNode *>q;\n            q.push(root);\n            \n            while (!q.empty())\n            {\n                curLevelCount = q.size();\n                vector<int> level;\n                while (curLevelCount--)\n                {\n                    temp = q.front();\n                    level.push_back(temp->val);\n                    if (temp->left != NULL)\n                        q.push(temp->left);\n                    if (temp->right != NULL)\n                        q.push(temp->right);\n                    q.pop();\n                }\n                ret.push_back(level);\n            }\n            \n            return ret;\n        }\n    };
['C++']