JAVA EASIEST SOLUTION EVER🤯🤯🤯|| STEP BY STEP EXPLAINED
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)$$ -->O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->O(N)\n![Screenshot_20230205_171246.png](https://assets.leetcode.com/users/images/51bbedff-1f62-4b98-b44c-78c8527fe5f0_1680010224.0268013.png)\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    public List<List<Integer>> levelOrder(TreeNode root) {\n        \n        // Initialize an empty list to hold the result\n        List<List<Integer>> result = new ArrayList<>();\n\n        // If the root is null, return an empty list\n        if (root == null) {\n            return result;\n        }\n\n        // Initialize a queue to hold the nodes in the current level\n        Queue<TreeNode> queue = new LinkedList<>();\n\n        queue.add(root);\n\n        // Traverse the tree level by level\n        while (!queue.isEmpty()) {\n            \n            // Get the number of nodes in the current level\n            int levelSize = queue.size();\n\n            // Initialize a list to hold the nodes in the current level\n            List<Integer> levelNodes = new ArrayList<>();\n\n            // Traverse the nodes in the current level\n            for (int i = 0; i < levelSize; i++) {\n                // Get the first node in the queue\n                TreeNode node = queue.remove();\n\n                // Add the node\'s value to the list of nodes in the current level\n                levelNodes.add(node.val);\n\n                // Add the node\'s children to the queue for the next level\n                if (node.left != null) {\n                    queue.add(node.left);\n                }\n                if (node.right != null) {\n                    queue.add(node.right);\n                }\n            }\n            // Add the list of nodes in the current level to the result\n            result.add(levelNodes);\n        }\n    // Return the final result\n    return result;\n    }\n}\n```
['Tree', 'Breadth-First Search', 'Queue', 'Binary Tree', 'Java']