298. Binary Tree Longest Consecutive Sequence : Past Google Coding Interview

Problem

https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/

How to Solve

This problem is classified into Tree and can be solve by using DFS(Depth First Search).

Depth First Search

Firstly, I thought the only search by DFS. The code is the following one.

Source Code