C++ Clean and Short Recursive and Iterative Solutions - With/Without Queue
First Solution - Recursive, No Queue\nRuntime: 0 ms, faster then 100%\n\nclass Solution {\npublic:\n    void rec(TreeNode* root, int level) {\n        if (!root
**First Solution - Recursive, No Queue**\nRuntime: 0 ms, faster then 100%\n```\nclass Solution {\npublic:\n    void rec(TreeNode* root, int level) {\n        if (!root) return;\n        if (level == res.size()) res.push_back({});\n        res[level].push_back(root->val);\n        rec(root->left, level+1);\n        rec(root->right, level+1);\n    }\n\t\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        rec(root, 0);\n        return res;\n    }\n    \nprivate:\n    vector<vector<int>> res;\n};\n```\n**Second Solution - Iterative, Using Queue**\nRuntime: 4 ms, faster than 80%\n```\nclass Solution {\npublic:\n    vector<vector<int>> levelOrder(TreeNode* root) {\n        if (!root) return {};\n\t\t\n        queue<TreeNode*> q;\n        vector<vector<int>> res;\n        vector<int> temp;\n        int size, i;\n        TreeNode* curr;\n        \n        q.push(root);\n        \n        while (!q.empty()) {\n            temp = {};\n            size = q.size();\n            \n            for (i = 0; i < q.size; i++) {\n                \n                curr = q.front();\n                q.pop();\n                \n                if (curr->left) q.push(curr->left);\n                if (curr->right) q.push(curr->right);\n                \n                temp.push_back(curr->val);\n            }\n            \n            res.push_back(temp);\n        }\n        \n        return res;\n    }\n};\n```\n**Like it? please upvote!\nHave any comments? I\'d love to hear!**
['Recursion', 'C', 'Iterator']