Write a function that takes as input a binary tree, and returns the length of the longest path.
For example, in this binary tree:
1
/ \
2 3
/
5
the answer is 2, since the path from vertex 1 to vertex 5 involves two edge traversals.