Problem Submissions Solution

Height of Binary Tree

Difficulty: Easy

Acceptance: 50.00%

Points: 20.00

Given a binary tree, find its height.

The height of a tree is defined as the number of nodes on the longest path from the root to a leaf node. A leaf node is a node that does not have any children.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n)

Expected Auxiliary Space: O(log n) for recursive calls.

Constraints:
  • 1 <= number of nodes <= 10^5
  • 0 <= node->data <= 10^5
Companies:
Amazon Microsoft DE Shaw Flipkart Zoho
Topics:
Tree
Locked Content
Access Restricted: Please Login to access the code editor and test cases.