mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 12:16:14 -04:00
13 lines
239 B
Python
13 lines
239 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
# author: bt3gl
|
|
|
|
|
|
def max_depth(root) -> int:
|
|
|
|
if root is None:
|
|
return 0
|
|
|
|
return max(max_depth(root.left) + 1, max_depth(root.right) + 1)
|
|
|