Error
|
|
---|---|
@Ibrahim Nash | 5761 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4989 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1115 |
@bt8816103042 | 739 |
@thealchemist627 | 456 |
@dalwainazism125 | 453 |
@akashkale117 | 453 |
@shivanandp12345678910 | 453 |
@codeantik | 448 |
@SherlockHolmes3 | 447 |
@SHOAIBVIJAPURE | 430 |
@shalinibhataniya1097 | 408 |
@ShamaKhan1 | 392 |
Complete Leaderboard |
Given a binary tree, find the depth of the deepest odd level leaf node in a binary tree. If there is no leaf at odd level then return 0.
Consider that level starts with 1. Depth of a leaf node is number of nodes on the path from root to leaf (including both leaf and root).
Input Format:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the number of edges. The next line contains the edges of the binary tree.
Output Format:
Print the depth of the deepest odd level leaf node in the binary tree.
Your task:
You don't need to read input/output. Complete the function depthOfOddLeafUtil
Constraints:
1<=T<=1000
1<=n<=1000
1<=data of node<=1000
Example:
Input:
2
10
1 2 L 2 4 L 1 3 R 3 5 L 3 6 R 5 7 R 7 9 L 6 8 R 8 10 R 10 11 L
4
1 2 L 2 4 L 1 3 R 3 5 L
Output:
5
3
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes