def longest_consecutive(root):
if root is None:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>max_len = <NUM_LIT:0><EOL>dfs(root, <NUM_LIT:0>, root.val, max_len)<EOL>return max_len<EOL>
:type root: TreeNode
:rtype: int