
104. Maximum Depth of Binary Tree
·
Algorithm
Maximum Depth of Binary Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. DFS를 이용한 내 풀이 class Solution: answer = 0 def maxDepth(self, root: TreeNode) -> int: def dfs(cur, depth): self.answer = max(self.answer, depth) if cur.left: dfs(cur.left, depth + 1) if cur.right: dfs(c..