Wednesday, July 18, 2018

Utopian Tree : Algorithms - Implementation

#The solution in Python3 is as follows:


for _ in range(int(input())):
       n=int(input())
       height=1
       i=1
       while i<=n:
            if i%2!=0:
                  height=2*height
            else:
                  height+=1
            i+=1
       print(height)


#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!