Skip to content
Given a binary tree, calculates the maximum path
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.settings
lib
resources
src
.classpath
.project
README
build.xml

README

To compile:
ant jar

To run:
ant jar
java -jar lib/krickert-maxpath.jar resources/data.txt 

Output:
Maximum value of path in triangle: [732506] and a path of: [[9235, 9096, 3269, 3350, 8032, 9642, 1921, 3674, 6345, 3058, 7324, 3248, 9558, 4473, 8497, 8487, 8099, 6534, 9326, 6145, 7750, 6287, 8414, 8230, 3774, 7628, 9434, 1897, 9306, 9161, 9644, 9081, 8047, 9729, 5151, 7337, 5596, 5963, 7901, 4237, 7944, 9646, 8844, 9357, 8136, 6544, 7359, 5969, 8177, 8548, 9262, 8539, 8028, 9766, 9833, 7641, 7792, 9397, 7542, 8108, 3216, 7644, 9461, 5124, 6477, 7119, 9022, 8466, 9721, 8208, 6996, 9763, 7650, 9048, 9385, 1335, 6481, 3307, 1459, 9075, 9094, 7098, 7030, 9313, 9605, 8451, 6150, 3036, 8207, 6683, 4102, 6118, 4982, 9172, 9760, 9730, 9983, 6679, 9720, 8324]]

To run tests:
ant test

Notes:
* Could make this more memory efficient if I wasn't saving the path along the way. 
* This will print the solution for each row as it goes.

Something went wrong with that request. Please try again.