Simple Java Solution. Same as level order traversal with a flag. No recursion
\npublic List<List<Integer>> zigzagLevelOrder(TreeNode root) {\n        List<List<Integer>> result = new ArrayList<>();\n        if(root==null) return result;\n
```\npublic List<List<Integer>> zigzagLevelOrder(TreeNode root) {\n        List<List<Integer>> result = new ArrayList<>();\n        if(root==null) return result;\n        \n        Queue<TreeNode> q = new LinkedList<>();\n        q.add(root);\n        Boolean reverse = false;\n        while(!q.isEmpty()){\n            int size = q.size();\n            List<Integer> temp = new ArrayList<>();\n            for(int i=0;i<size;i++){\n                TreeNode node = q.poll();\n                if(!reverse)\n                    temp.add(node.val);\n                else\n                    temp.add(0,node.val);\n                if(node.left!=null) q.add(node.left);\n                if(node.right!= null) q.add(node.right);\n            }\n            result.add(temp);\n            reverse=!reverse;\n        }\n        return result;\n    }\n```
[]