📌Easy C++ Solution | Just a small change in Level Order
Obervesion: We just need to reverse the alternate levels, rest is same as Level Ordering.\n\n\nclass Solution {\npublic:\n    vector<vector<int>> zigzagLevelOrd
Obervesion: We just need to reverse the alternate levels, rest is same as Level Ordering.\n\n```\nclass Solution {\npublic:\n    vector<vector<int>> zigzagLevelOrder(TreeNode* root) \n    {\n        vector <vector<int>> v;\n        if(!root) // if root is null return\n            return v;\n        queue <TreeNode*> q;\n        q.push(root);\n        int count = 1; // we want reverse the list at alternate order\n        while(!q.empty())\n        {\n            int n = q.size();\n            vector <int> l;\n            \n            while(n--)\n            {\n                root=q.front();\n                q.pop();\n                l.push_back(root->val);\n                if(root->left)\n                    q.push(root->left);\n                if(root->right)\n                    q.push(root->right);\n            }\n            if(count%2==0) // we want reverse the list at alternate order\n                reverse(l.begin(),l.end());\n            v.push_back(l);\n            count++;\n        }\n        \n        return v;\n        \n    }\n};\n```\n
['C', 'C++']