I'm trying to conceptualize this problem and then write Java code for it. I know there's been some discussion here, but I'm not seeing lots of answerers, so I'd like to reiterate the question by writing out my thoughts and I'm hoping to gain some feedback from you guys. Thanks!
My thoughts: For each leaf node Find the longest path from the root node to it For all paths Find the maximum path length
However, isn't this simply brute force? Are there more elegant solutions to this?
I heard of using Djikstra's algorithm with negative weights, but in some places it says that this only works on specified cases? I've also seen suggestions for the Bellman Ford algorithm, but isn't that used to find the shortest path?
Thanks!!