Medium Accuracy: 25.81% Submissions: 1668 Points: 4
Given an array A of N integers, where each integer is greater than 1.The task is to find the number of Full binary tree from the given integers, such that each non leaf node value is the product of its children value. Note: Each integer can be used multiple times in a full binary tree.
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each line contains an integer N denoting the size of the array A. Then in the next line are N space separated values of the array A.
For each test case in a new line print an integer denoting the result.
1 <= T <= 100
1 <= N <= 100
2 3 4 6
2 4 5
Testcase 1: 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