## Binary Tree Longest Increasing Path (Recursive)

Im writing some code to get the longest Increasing path needs to return the number of edges. The Issue I am having is with how to write code to return if there is more than one sequence in the tree.

```//             1
/ \
2  3
/
1
/
2
/
3```

The Above tree will return 3 vs the 2 it should be (Edges not nodes)

```public static int longestIncreasingPath(BinaryNode<Integer> root)
{
if(root == null)
return 0;

BinaryNode<Integer> left, right;
left = root.getLeft();
right = root.getRight();

int leftSide = 0; int rightSide = 0;

if(left != null && left.getElement() > root.getElement())
leftSide =+ 1 + longestIncreasingPath(left);
else
leftSide =+ longestIncreasingPath(left);

if(right != null && right.getElement() > root.getElement())
rightSide =+ 1 + longestIncreasingPath(right);
else
rightSide =+ longestIncreasingPath(right);

return leftSide > rightSide ? leftSide : rightSide;
}```

Maybe someone can help me with this and explain a method to figuring this out. I just have a hard time with recursion techniques. Im fairly good in loops and any other logic, but recursion just destroys me.