Skip to content

Commit b38a94d

Browse files
Removed mistakenly added semicolon
1 parent 8b1d10d commit b38a94d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

Project-Euler/Problem8.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
// Problem: https://projecteuler.net/problem=8
22

33
const largestAdjacentNumber = (grid, consecutive) => {
4-
grid = grid.split('\n').join('');
5-
const splitedGrid = grid.split("\n");
6-
let largestProd = 0;
4+
grid = grid.split('\n').join('')
5+
const splitedGrid = grid.split('\n')
6+
let largestProd = 0
77

8-
for (let row in splitedGrid) {
9-
const currentRow = splitedGrid[row].split('').map(x => Number(x));
8+
for (const row in splitedGrid) {
9+
const currentRow = splitedGrid[row].split('').map(x => Number(x))
1010

1111
for (let i = 0; i < currentRow.length - consecutive; i++) {
12-
const combine = currentRow.slice(i, i + consecutive);
12+
const combine = currentRow.slice(i, i + consecutive)
1313

1414
if (!combine.includes(0)) {
1515
const product = combine.reduce(function (a, b) {
1616
return a * b
17-
});
17+
})
1818

19-
if (largestProd < product) largestProd = product;
19+
if (largestProd < product) largestProd = product
2020
}
2121
}
2222
}
23-
return largestProd;
23+
return largestProd
2424
}
2525

26-
export { largestAdjacentNumber };
26+
export { largestAdjacentNumber }

Project-Euler/test/Problem8.test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { largestAdjacentNumber } from '../Problem8';
1+
import { largestAdjacentNumber } from '../Problem8'
22

33
const grid1 = `73167176531330624919225119674426574742355349194934
44
96983520312774506326239578318016984801869478851843
@@ -19,7 +19,7 @@ const grid1 = `73167176531330624919225119674426574742355349194934
1919
84327878357761783787589375857378271083787811983779
2020
84580156166097919133875499200524063689912560717606
2121
05886116467109405077541002256983155200055935729725
22-
82347875831098357801578571807585817518287829189189`;
22+
82347875831098357801578571807585817518287829189189`
2323

2424
const grid2 = `73167176531330624919225119674426574742355349194934
2525
96983520312774506326239578318016984801869478851843
@@ -40,7 +40,7 @@ const grid2 = `73167176531330624919225119674426574742355349194934
4040
07198403850962455444362981230987879927244284909188
4141
84580156166097919133875499200524063689912560717606
4242
05886116467109405077541002256983155200055935729725
43-
71636269561882670428252483600823257530420752963450`;
43+
71636269561882670428252483600823257530420752963450`
4444

4545
const grid3 = `89125732138957892357892768971807934878999818278898
4646
48327483578957875827583295789187588875238579887789
@@ -61,7 +61,7 @@ const grid3 = `89125732138957892357892768971807934878999818278898
6161
10783974839479879857895789758975981735870175835789
6262
01494787857897583758975849758475107589754897589789
6363
09939858758919788017587897587387585775289757982898
64-
74718478978758758975897589789789798789178957789789`;
64+
74718478978758758975897589789789798789178957789789`
6565

6666
const grid4 = `99999999999999999999999999999999999999999999999999
6767
99999999999999999999999999999999999999999999999999
@@ -82,7 +82,7 @@ const grid4 = `99999999999999999999999999999999999999999999999999
8282
99999999999999999999999999999999999999999999999999
8383
99999999999999999999999999999999999999999999999999
8484
99999999999999999999999999999999999999999999999999
85-
99999999999999999999999999999999999999999999999999`;
85+
99999999999999999999999999999999999999999999999999`
8686

8787
describe('checkLargestAdjacentNumberProduct', () => {
8888
it('Random Example', () => {

0 commit comments

Comments
 (0)