문돌이 존버/프로그래밍 스터디
2021. 7. 24.
(leetcode 문제 풀이) Maximum Depth of Binary Tree
Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Constraints: 1. The number of nodes in the tree is in the range [0, 104]. 2. -100 int: if not root: return 0 left_level = self.maxDepth(root.left) + 1 right_level = self.maxDepth(root.right) + 1 return max(left_l..