Error
|
|
---|---|
@Ibrahim Nash | 5765 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4993 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1272 |
@bt8816103042 | 739 |
@rohitanand | 495 |
@codeantik | 479 |
@shalinibhataniya1097 | 472 |
@amrutakashikar2 | 464 |
@thealchemist627 | 456 |
@dalwainazism125 | 453 |
@shivanandp12345678910 | 453 |
@akashkale117 | 453 |
@SherlockHolmes3 | 447 |
Complete Leaderboard |
Input:
N = 4
A[] = {2, 3, 4, 6}
Output:
7
Explanation:
There are 7 full binary tree with
the given product property.
Four trees with single nodes
2 3 4 6
Three trees with three nodes
4 ,
/ \
2 2
6 ,
/ \
2 3
6
/ \
3 2
Input: N = 3
A[] = {2, 4, 5}
Output: 7
Explanation: There are 4 full binary tree
with the given product property.
Three trees with single nodes 2 4 5
One tree with three nodes
6
/ \
3 2
Your Task:
You don't need to read input or print anything. Your task is to complete the function numoffbt() which takes the array A[]and its size N as inputs and returns the number of Full binary tree.
Expected Time Complexity: O(N. Log(N))
Expected Auxiliary Space: O(N)
Constraints:
1 ≤ N ≤ 104
1 ≤ A[i] ≤ 104
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes