#NEWLINE# def dfs_error( self , root , cur , result ) : #NEWLINE# #INDENT# '\n        Using list as cur has some reference issues\n        :param root: TreeNode\n        :param cur: list\n        :param result: list\n        :return: None\n        ' #NEWLINE# if ( not root ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# cur . append ( root . val ) #NEWLINE# if ( ( not cur . left ) and ( not root . right ) ) : #NEWLINE# #INDENT# result . append ( cur ) #NEWLINE# return #NEWLINE# #UNINDENT# if root . left : #NEWLINE# #INDENT# self . dfs_error ( root . left , cur , result ) #NEWLINE# #UNINDENT# if root . right : #NEWLINE# #INDENT# self . dfs_error ( root . right , cur , result )