104-Maximum-Depth-Of-Binary-Tree
Sat 17 May 2025
https://leetcode.com/problems/maximum-depth-of-binary-tree
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def maxDepth(self, root: Optional[TreeNode]) -> int:
if not root:
return 0
return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
new Solution().maxDepth()
Score: 5
Category: leetcode