Problem 67: Find the maximum total from top to bottom in triangle.txt, a 15K text file containing a triangle with one-hundred rows.
import java.util.Vector;
public class test {
public static void main(String[] args) {
String triangle = "Full String located: http://archiver.joshho.com/display.php?&q=https://projecteuler.net/project/triangle.txt";
String[] lines = triangle.split("\n");
Vector> map = new Vector>();
//populate vector
for(int i = 0; i < lines.length; i++){
String[] line = lines[i].split(" ");
Vector sub = new Vector();
for(int j=0;j-1;i--){
Vector sub = map.get(i);
Vector prev = map.get(i+1);
for(int j=0;j prev.get(j+1) ? prev.get(j) : prev.get(j+1)));
}
}
System.out.println(map.get(0).get(0));
}
}