Skip to content

Commit db38314

Browse files
Add solution for Project-Euler Problem15
1 parent 001fcba commit db38314

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Project-Euler/Problem015.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// https://projecteuler.net/problem=15
2+
/* Starting in the top left corner of a 2×2 grid, and only being able to move to
3+
the right and down, there are exactly 6 routes to the bottom right corner.
4+
How many such routes are there through a 20×20 grid?
5+
*/
6+
7+
const latticePath = n => {
8+
9+
for (var i = 1, c = 1; i <= n; i++)
10+
c = c * (n + i) / i;
11+
return c;
12+
}
13+
console.log(latticePath(20));

0 commit comments

Comments
 (0)