We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a85301 commit 5634819Copy full SHA for 5634819
my-submissions/e559.py
@@ -0,0 +1,15 @@
1
+"""
2
+# Definition for a Node.
3
+class Node:
4
+ def __init__(self, val: Optional[int] = None, children: Optional[List['Node']] = None):
5
+ self.val = val
6
+ self.children = children
7
8
+
9
+class Solution:
10
+ def maxDepth(self, root: 'Node') -> int:
11
+ if not root :
12
+ return 0
13
+ if not root.children :
14
+ return 1
15
+ return max(self.maxDepth(x) for x in root.children) + 1
0 commit comments