Skip to content

Instantly share code, notes, and snippets.

@p53ud0k0d3
Created March 19, 2015 15:49
Show Gist options
  • Save p53ud0k0d3/205deb01c69a53701a19 to your computer and use it in GitHub Desktop.
Save p53ud0k0d3/205deb01c69a53701a19 to your computer and use it in GitHub Desktop.
HackerRank Utopian Tree
height = 1
N = []
for _ in xrange(int(raw_input())):
N.append(int(raw_input()))
for item in N:
if item == 0:
print 1
else :
for i in xrange(1, item+1):
if i%2 == 1:
height *= 2
else :
height += 1
print height
height = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment