We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Data Structures
  3. Trees
  4. Tree: Height of a Binary Tree
  5. Discussions

Tree: Height of a Binary Tree

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • kbenriquez 3 years ago+ 0 comments

    one liner using your logic

    return -1 if root is None else max(height(root.left) + 1, height(root.right) + 1)
    
    -3|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature