Challenge 1: height of binary tree

Can someone please tell me why does the base case has value -1 ? shouldnt it be 0?

guard let node = node else{ return -1; }

@sahsubodh Please let me know which chapter is the challenge from when you get a chance. Thank you!

its chapter 13 challenge 1.

@kelvin_lau Can you please help with this when you get a chance? Thank you - much appreciated! :]

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!