maxLength to 0.dfs that takes a node p, its parent node parent, and the current length of the consecutive sequence.p is null, return immediately.p is consecutive with its parent (i.e., p.val == parent.val + 1), increment length; otherwise, reset length to 1.maxLength with the maximum of its current value and length.dfs for the left and right children of p, passing the current node as the parent and the updated length.maxLength as the result.