Skip to content

Instantly share code, notes, and snippets.

@tech-cow
Created October 19, 2018 20:03
Show Gist options
  • Select an option

  • Save tech-cow/305a2278f8a4e74ac294eafa4717c35f to your computer and use it in GitHub Desktop.

Select an option

Save tech-cow/305a2278f8a4e74ac294eafa4717c35f to your computer and use it in GitHub Desktop.
def getHeight(root):
if not root: return 0
left = getHeight(root.left)
right = getHeight(root.right)
return max(left, right) + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment