Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.
How many routes are there through a 2020 grid?
This is your standard Pascal’s triangle problem. Wiki has tons of great stuff on it. No doubt this one will come back in a later problem.
public class Euler15
public static void main(String args)
Euler15 e = new Euler15();
System.out.print(“Answer = ” + e.Problem()+ “\n”);
public String Problem ()
int rows = 20;
int cols = 20;
return String.valueOf(P(2*rows, cols));
public static long P(int row, int col)
long current = 1;
for (int i = 1; i <= col; i++ )
current = (current * (row + 1 – i)) / i;