BBT counter
Easy Accuracy: 15.56% Submissions: 2360 Points: 2

Given a height h, count and return the maximum number of balanced binary trees possible with height h. A balanced binary tree is one in which for every node, the difference between heights of left and right subtree is not more than 1.

Input:
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 height h.

Output:
Count the maximum number of balanced binary trees possible with height h.

Constraints:
1 <= T <= 100
1 <= h <= 1000

Example:
Input:

2
3
70

Output:
40
327960719

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Output Window