My C++ 0ms (faster than 100%) solution with simple explanation.
One thing to notice is that whenever we encounter a problem having something related to level order than BFS must come in our mind. Hence by using queue we can 
One thing to notice is that whenever we encounter a problem having something related to level order than BFS must come in our mind. Hence by using queue we can push all children level by level and do the required thing as asked in problem statement.\n\nHere we can see that on zero level we want ans vector to have elements from left to right , on one level we need elements from right to left and so on the pattern continues.\n\nSo our approach will be to store elements from left to right on even level and right to left on odd level.\n\nBelow is the code which will explain the above things with implementation :\n\n```\nclass Solution\n{\npublic:\n    vector<vector<int>> zigzagLevelOrder(TreeNode* root)\n    {\n        vector<vector<int>> ans; // Storing answer\n        map<int, deque<int>> m; // Storing level wise elements and taking Deque to store elemets from left to right or vice versa\n\n        if(root == NULL) // Handling edge cases right upfront\n            return ans;\n\n        queue<pair<TreeNode*, int>> q; // queue to store address and id(level) of node\n        q.push({root, 0}); // Root node with id = 0\n\n        while(q.size())\n        {\n            TreeNode* cur = q.front().F;\n            int id = q.front().S;\n            q.pop();\n\n            if(id % 2) // if level is odd then we need elements from right to left\n                m[id].push_front(cur->val);\n\n            else       // if level is even then we need elements from left to right\n                m[id].push_back(cur->val);\n\n            // pushing right and left child if they are not null with incrementing id(level)\n\n            if(cur->left)\n                q.push({cur->left, id + 1});\n\n            if(cur->right)\n                q.push({cur->right, id + 1});\n\n        }\n\n        for(auto it = m.begin(); it != m.end(); it++)\n        {\n            vector<int> mid;\n\n            while(i->second.size()) // retrieving elements from deque\n            {\n                mid.P_B(i->second.front());\n                i->second.pop_front();\n\n            }\n\n            ans.push_back(mid); // pushing into answer vector\n\n        }\n\n        return ans;\n\n    }\n};\n```
['Breadth-First Search', 'Queue']