In Project Euler\'s problem 67 there is a triangle given and it contains 100 rows. For e.g.
5
9 6
4 6 8
0 7 1 5
I.e. 5 + 9 + 6 + 7
I believe this is a Project Euler problem.
It can't be represented with a binary tree. Any kind of graph is overkill as well, though the problem can be solved with a longest path algorithm in directed acyclic graphs. Edit: Nevermind that, it is only useful if the edges are weighted, not the nodes.
A two dimensional vector (e.g. vector
) is more than enough to represent such triangles, and there is a straightforward solution using such representation.