Skip to content

Commit

Permalink
[BUGFIX] sonarcloud typescript:S6959 fixed.
Browse files Browse the repository at this point in the history
"Array.reduce()" calls should include an initial value
  • Loading branch information
Gonzalo Diaz committed May 9, 2024
1 parent a471429 commit 8d515c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/projecteuler/problem0018.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export function problem0018(_triangle: number[][]): number {
console.debug(`leafs count: ${leafs.length}`);
console.debug(`leafs: ${leafs}`);

const max = leafs.reduce((a, b) => (a > b ? a : b));
const __START_FROM__ = 0;
const max = leafs.reduce((a, b) => (a > b ? a : b), __START_FROM__);

return max;
}
Expand Down

0 comments on commit 8d515c9

Please sign in to comment.