Skip to content

Commit 0b9c308

Browse files
committed
Create README - LeetHub
1 parent fcfc92a commit 0b9c308

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Height of Binary Tree - GFG/README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Height of Binary Tree
2+
## Medium
3+
<div class="problem-statement">
4+
<p></p><p><span style="font-size:18px">Given a binary tree, find its height.</span></p>
5+
6+
<p><br>
7+
<span style="font-size:18px"><strong>Example 1:</strong></span></p>
8+
9+
<pre><span style="font-size:18px"><strong>Input:</strong>
10+
1
11+
/ \
12+
2 3
13+
<strong>Output:</strong> 2</span>
14+
</pre>
15+
16+
<p><span style="font-size:18px"><strong>Example 2:</strong></span></p>
17+
18+
<pre><span style="font-size:18px"><strong>Input:</strong>
19+
2
20+
\
21+
1
22+
/
23+
3
24+
<strong>Output:</strong> 3 </span></pre>
25+
26+
<p><br>
27+
<span style="font-size:18px"><strong>Your Task:</strong><br>
28+
You don't need to read input or print anything. Your task is to complete the function <strong>height() </strong>which takes root node of the tree as input parameter and returns an integer denoting the height of the tree. If the tree is empty, return 0.&nbsp;</span></p>
29+
30+
<p><br>
31+
<span style="font-size:18px"><strong>Expected Time Complexity:</strong> O(N)<br>
32+
<strong>Expected Auxiliary Space:</strong> O(N)</span></p>
33+
34+
<p><br>
35+
<span style="font-size:18px"><strong>Constraints:</strong><br>
36+
1 &lt;= Number of nodes &lt;= 10<sup>5</sup><br>
37+
1 &lt;= Data of a node &lt;= 10<sup>5</sup></span></p>
38+
<p></p>
39+
</div>

0 commit comments

Comments
 (0)