It looks like a good dynamic programming solution. Small Details I don't like that you copy the full triangle in TriangleResult. You can just store the relevant path. You could define rowIndex right before its use in findShortestPath. I don't like raw arrays, but it might OK here for performa...