#NEWLINE# def longestConsecutive_error( self , root ) : #NEWLINE# #INDENT# '\n        :type root: TreeNode\n        :rtype: int\n        ' #NEWLINE# if ( not root ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# maxa = 1 #NEWLINE# l = self . longestConsecutive ( root . left ) #NEWLINE# r = self . longestConsecutive ( root . right ) #NEWLINE# maxa = max ( maxa , l , r ) #NEWLINE# if ( root . left and ( ( root . val + 1 ) == root . left . val ) ) : #NEWLINE# #INDENT# maxa = max ( maxa , ( l + 1 ) ) #NEWLINE# #UNINDENT# if ( root . right and ( ( root . val + 1 ) == root . right . val ) ) : #NEWLINE# #INDENT# maxa = max ( maxa , ( r + 1 ) ) #NEWLINE# #UNINDENT# return maxa