✅Python3 34ms 82% fast 🔥🔥🔥
Intuition\n Describe your first thoughts on how to solve this problem. \nUsing dfs level order traversal we can solve this.\n\n\n\n# Approach\n- make answer arr
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n**Using dfs level order traversal we can solve this.**\n![Capture.PNG](https://assets.leetcode.com/users/images/28445110-35f3-475a-97a7-844060ac8757_1676791090.2594106.png)\n\n\n# Approach\n- make answer array = []\n- now traverse nodes from left to right.\n- if current node is empty return.\n- if not then if current level is in answer array then append currennt node else create level in array and append current value.\n- return answer.\n\n# Complexity\n- Time complexity: O(height of tree)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def levelOrder(self, root: Optional[TreeNode]) -> List[List[int]]:\n        ans = []\n        def bfs(curr = root, level = 0):\n            nonlocal ans\n            if curr:\n                if len(ans) > level:\n                    ans[level].append(curr.val)\n                else:\n                    ans.append([curr.val])\n                bfs(curr.left, level + 1)\n                bfs(curr.right, level + 1)\n            return\n        bfs()\n        return ans\n```\n# Please like and comment below.\n# (\u3063\uFF3E\u25BF\uFF3E)\u06F6\uD83C\uDF78\uD83C\uDF1F\uD83C\uDF7A\u0669(\u02D8\u25E1\u02D8 )
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree', 'Python3']