Skip to content

Commit b35104a

Browse files
authored
chore: Fix code formatting
1 parent 22fcd2d commit b35104a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Project-Euler/Problem015.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ How many such routes are there through a 20×20 grid?
77
// A lattice path is composed of horizontal and vertical lines that pass through lattice points.
88

99
const latticePath = (gridSize) => {
10-
for (var i = 1, paths = 1; i <= gridSize; i++)
10+
let paths
11+
for (let i = 1, paths = 1; i <= gridSize; i++) {
12+
paths = paths * (gridSize + i) / i
13+
}
1114
// The total number of paths can be found using the binomial coefficient (b+a)/a.
12-
{ paths = paths * (gridSize + i) / i }
1315
return paths
1416
}
1517
console.log(latticePath(20)) // output = 137846528820

0 commit comments

Comments
 (0)