Given an integer i. Print the maximum number of nodes on level i of a binary tree.
Example 1:
Input: 5
Output: 16
Example 2:
Input: 1
Output: 1
 
Your Task:
Complete the function countNode() which takes an integer i as input and prints the count of maximum number of nodes at that level.
 
Expected Time Complexity: O(1)
Expected Space Complexity: O(1)
 
Constraints:
1<=i<=20

Source: geeksforgeeks | Difficulty: MEDIUM

Starter code: #User function Template for python3



class Solution:

    def countNodes(self, i):

        # Code here

Solutions:
class Solution:

	def countNodes(self, i):
		return 2 ** (i - 1)


import math

class Solution:

	def countNodes(self, i):
		return int(math.pow(2, i - 1))


class Solution:

	def countNodes(self, i):
		if i == 1:
			return 1
		else:
			return 2 ** (i - 1)


class Solution:

	def countNodes(self, i):
		x = pow(2, i - 1)
		return x


class Solution:

	def countNodes(self, i):
		ans = pow(2, i - 1)
		return ans


class Solution:

	def countNodes(self, i):
		if i == 0:
			return 0
		return 2 ** (i - 1)


class Solution:

	def countNodes(self, i):
		if i == 1:
			return 1
		else:
			count = 1
			while i > 1:
				count = count * 2
				i = i - 1
		return count


class Solution:

	def countNodes(self, i):
		if i == 0:
			return 0
		elif i == 1:
			return 1
		else:
			return 2 ** (i - 1)


import math

class Solution:

	def countNodes(self, i):
		return 2 ** (i - 1)


class Solution:

	def countNodes(self, i):
		n = i
		if n == 0:
			return -1
		if n == 1:
			return 1
		x = 2 ** n
		y = x // 2
		if y % 2 == 0:
			return y
		else:
			return y - 1


class Solution:

	class Node:

		def __init__(self, val):
			self.val = val
			self.left = None
			self.right = None

	def countNodes(self, i):
		root = Solution.Node(1)
		for j in range(2, 1025):
			node = root
			path = bin(j)[3:]
			for direction in path:
				if direction == '0':
					if node.left is None:
						node.left = Solution.Node(j)
					node = node.left
				else:
					if node.right is None:
						node.right = Solution.Node(j)
					node = node.right

		def countNode(root, level):
			if root is None:
				return 0
			if level == 1:
				return 1
			return countNode(root.left, level - 1) + countNode(root.right, level - 1)
		return countNode(root, i)


class Solution:

	def countNodes(self, i):
		if i == 1:
			return 1
		return pow(2, i - 1)


class Solution:

	def countNodes(self, i):
		if i == 0:
			return 0
		elif i == 1:
			return 1
		else:
			n = 1
			for j in range(1, i):
				n *= 2
			return n


class Solution:

	def countNodes(self, i):
		low = 2 ** (i - 1)
		high = 2 ** i - 1
		return high - low + 1


class Solution:

	def countNodes(self, i):
		if i == 1:
			return 1
		if i > 1:
			a = 2 ** (i - 1)
			return a


class Solution:

	def countNodes(self, i):
		if i == 1:
			return 1
		j = 2
		c = 1
		while c < i - 1:
			j += j
			c += 1
		return j


class Solution:

	def countNodes(self, i):
		return 2 ** (i - 1)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		i = int(input())
		ob = Solution()
		res = ob.countNodes(i)
		print(res)


class Solution:

	def countNodes(self, i):
		s = 1
		for i in range(1, i):
			s *= 2
		return s


class Solution:

	def countNodes(self, i):
		max = 0
		max = 2 ** (i - 1)
		return max


from collections import deque

class Solution:

	def countNodes(self, i):
		return 2 ** (i - 1)