If both left and right returns 0 , it means there is no valid path till leaf node
if ( left == 0 and right == 0 ) : NEW_LINE INDENT return 0 NEW_LINE DEDENT return ( 1 + max ( left , right ) ) NEW_LINE def heightOfTree ( root ) : NEW_LINE return heightOfTreeUtil ( root , False ) NEW_LINE