Since the given height of tree is k, and we also know that a binary tree can contain maximum two nodes in one level, hence we can have a total of 2^k nodes.
Height 1: 1 node=21−1=21−1
Height 2: 1+2 nodes=22−1=22−1
Height 3: 1+2+4 nodes=23−1=23−1
So the general pattern is height h=2ℎ−1=2h−1 nodes.