haoel/leetcode — pull request #40 by FreeJoker (2014-11-29 10:44:30+00:00)
Title: reduce time complexity O(n²) to O(n)

the solution can be optimized by calculating the treeDepth in the same recursion rather than calling a treeDepth() function separately.