✅💯🔥Simple Code🚀📌|| 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n *     TreeNode(int val) { this.val = val; }\n *     TreeNode(int val, TreeNode left, TreeNode right) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\nclass Solution {\n    List<List<Integer>> ans = new ArrayList<>();\n    public List<List<Integer>> zigzagLevelOrder(TreeNode root) {\n        if(root==null){\n            return ans;\n        }\n        Queue<TreeNode> q = new LinkedList<>();\n        q.add(root);\n        q.add(null);\n        int i=1;\n        List<Integer> subans= new ArrayList<>();\n        while(!q.isEmpty()){\n            TreeNode curr = q.remove();\n            if(curr==null){\n                if(i%2==0){\n                    Collections.reverse(subans);\n                    ans.add(subans);\n                }else{\n                    ans.add(subans);\n                }\n                i++;\n                if(q.isEmpty()){\n                    break;\n                } else{\n                    q.add(null);\n                    subans=new ArrayList<>();\n                }\n            }else{\n                subans.add(curr.val);\n                if(curr.left!=null){\n                    q.add(curr.left);\n                }\n                if(curr.right!=null){\n                    q.add(curr.right);\n                }\n            }\n        }\n        return ans; \n    }\n}\n```\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Tree', 'Breadth-First Search', 'C', 'Binary Tree', 'Python', 'C++', 'Java']