Matsushita's Blog

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


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