Given a binary tree, return the longest path within the binary tree. For example, a preorder traverse is "A B C E # # # D # F # #" is 5. The path is from E to F.
@dukeforever Would you write down the tree? Thank you. We cannot restore the tree with only one traversal
Isn't this the problem for finding tree diameter? Were there any additional requirements?
@elmirap Preorder: "ABCEDF", Inorder: "ECBDFA". I think so. No other constraints.