Can someone please tell me why does the base case has value -1 ? shouldnt it be 0?
guard let node = node else{ return -1; }
Can someone please tell me why does the base case has value -1 ? shouldnt it be 0?
guard let node = node else{ return -1; }
its chapter 13 challenge 1.
Hey!
The definition of height for a binary tree is “the length of the path from root to the furthest leaf node”. A tree with just a root has a height of 0. A tree with no nodes doesn’t really have a height. In this case, we represent that using -1.
Hope that helps!