I have the following tree
1
2 3
4 5 6
7 8 9 0
Now i want to walk through all possible paths trough the tree. It is always possible to move to adjacent numbers from the row below. For example
1 2 4 7 or 1 2 5 8
Any hints what is the best way to do that? I’m looking for a general hint, but in my implementation I have an ArrayList for each row.
I suspect using recursion is the simplest way.
something like