here is my solution:

'''

```
def maxDepth(self,root):
if not root:
return 0
stack = []
maximum = 1
stack.append((root,1))
while stack:
root,d = stack.pop()
if root.left:
stack.append((root.left,d+1))
if root.right:
stack.append((root.right,d+1))
if not root.left and not root.right :
maximum = max(maximum,d)
return maximum
```

'''