#K69617. Dessert Towers
Dessert Towers
Dessert Towers
You are given several test cases. In each test case, you have a list of fruit sweetness levels. A tower is defined as any non-empty subset of the given fruits arranged in non-decreasing order of sweetness. Since any subset when sorted is non-decreasing, the total number of valid towers can be computed by counting all non-empty subsets.
More formally, if the list contains n fruits, then the number of valid towers is given by the formula:
\(2^n - 1\)
For each test case, your task is to compute the number of valid towers.
inputFormat
The first line contains an integer T (the number of test cases).
For each test case, the first number is an integer n (the number of fruits). The following n integers represent the sweetness levels of the fruits.
Example:
4 3 1 2 3 3 2 3 1 2 1 2 1 5
outputFormat
For each test case, output a single integer representing the number of valid dessert towers (i.e. \(2^n - 1\)) on a new line.
## sample4
3 1 2 3
3 2 3 1
2 1 2
1 5
7
7
3
1
</p>