C# queue
\npublic class Solution {\n    public IList<IList<int>> ZigzagLevelOrder(TreeNode root) {\n        var result = new List<IList<int>>();\n        if (root == nul
```\npublic class Solution {\n    public IList<IList<int>> ZigzagLevelOrder(TreeNode root) {\n        var result = new List<IList<int>>();\n        if (root == null) return result;\n\n        var queue = new Queue<TreeNode>();\n        queue.Enqueue(root);\n\n        while (queue.Any()) {\n            var size = queue.Count;\n            var oneResult = new List<int>();\n            for (int s = 0; s < size; s++) {\n                var cur = queue.Dequeue();\n                oneResult.Add(cur.val);\n\n                if (cur.left != null) {\n                    queue.Enqueue(cur.left);\n                }\n\n                if (cur.right != null) {\n                    queue.Enqueue(cur.right);\n                }\n            }\n\n            if (result.Count % 2 == 1) {\n                oneResult.Reverse();\n            }\n            result.Add(oneResult);\n        }\n\n        return result;\n    }\n}\n```
[]