From 22fcd2d5ee6dba3862a7f6ff5f64c4e6cdc62e62 Mon Sep 17 00:00:00 2001 From: Kim Date: Wed, 7 Jul 2021 19:34:04 +0300 Subject: [PATCH] code formatted using standard.js --- Project-Euler/Problem015.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Project-Euler/Problem015.js b/Project-Euler/Problem015.js index 35b1aa807..cd20fa204 100644 --- a/Project-Euler/Problem015.js +++ b/Project-Euler/Problem015.js @@ -4,13 +4,12 @@ the right and down, there are exactly 6 routes to the bottom right corner. How many such routes are there through a 20×20 grid? */ -//A lattice path is composed of horizontal and vertical lines that pass through lattice points. +// A lattice path is composed of horizontal and vertical lines that pass through lattice points. const latticePath = (gridSize) => { - - for (var i = 1, paths = 1; i <= gridSize; i++) - //The total number of paths can be found using the binomial coefficient (b+a)/a. - paths = paths * (gridSize + i) / i; - return paths; + for (var i = 1, paths = 1; i <= gridSize; i++) + // The total number of paths can be found using the binomial coefficient (b+a)/a. + { paths = paths * (gridSize + i) / i } + return paths } -console.log(latticePath(20)); //output = 137846528820 +console.log(latticePath(20)) // output = 137846528820