[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/TheAlgorithms/JavaScript/master/Project-Euler/Problem015.js [Back]  [Original]

// https://projecteuler.net/problem=15
/* Starting in the top left corner of a 22 grid, and only being able to move to
the right and down, there are exactly 6 routes to the bottom right corner.
How many such routes are there through a 2020 grid?
*/

// A lattice path is composed of horizontal and vertical lines that pass through lattice points.

export const latticePath = (gridSize) => {
  let paths
  for (let i = 1, paths = 1; i  latticePath(20))
// 137846528820

Web Proxy Viewer  |  New URL  |  Original Page