fork download
  1. # your code goes here
  2. class Node:
  3. def __init__(self, val=0, left=None, right=None):
  4. self.val = val
  5. self.left = left
  6. self.right = right
  7.  
  8. def height(root):
  9. if not root:
  10. return 0
  11. return 1 + max(height(root.left), height(root.right))
Success #stdin #stdout 0.09s 14020KB
stdin
Standard input is empty
stdout
Standard output is empty