Java DFS based solution || Beats 100%
Using dfs to generate level order traversal and then reversing every odd level.\n\npublic List<List<Integer>> zigzagLevelOrder(TreeNode root) {\n        List<Li
Using dfs to generate level order traversal and then reversing every odd level.\n```\npublic List<List<Integer>> zigzagLevelOrder(TreeNode root) {\n        List<List<Integer>> ans = new ArrayList<>();\n        dfs(root,0,ans);\n        for(int i = 0; i < ans.size(); i++) if((i&1) == 1) Collections.reverse(ans.get(i));\n        return ans;\n    }\n    public void dfs(TreeNode root,int level,List<List<Integer>> list){\n        if(root == null) return;\n        if(list.size() == level) list.add(new ArrayList<>());\n        list.get(level).add(root.val);\n        dfs(root.left,level+1,list);\n        dfs(root.right,level+1,list);\n    }\n```
[]