Skip to content

Commit 5f18178

Browse files
author
Gonzalo Diaz
committed
[BUGFIX] sonarcloud typescript:S6959 fixed.
"Array.reduce()" calls should include an initial value
1 parent 158239e commit 5f18178

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/projecteuler/problem0018.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export function problem0018(_triangle: number[][]): number {
3131
console.debug(`leafs count: ${leafs.length}`);
3232
console.debug(`leafs: ${leafs}`);
3333

34-
const max = leafs.reduce((a, b) => (a > b ? a : b));
34+
const __START_FROM__ = 0;
35+
const max = leafs.reduce((a, b) => (a > b ? a : b), __START_FROM__);
3536

3637
return max;
3738
}

0 commit comments

Comments
 (0)