Skip to content

Commit ac33aa8

Browse files
authored
Merge pull request #785 from sir-gon/develop
Develop
2 parents f2cc36d + 58517d5 commit ac33aa8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/hackerrank/interview_preparation_kit/dynamic_programming/max_array_sum.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
*/
55

66
const bigIntMax = (...args) =>
7-
args.reduce((m, e) => (e > m ? e : m), BigInt(0));
7+
args.reduce((m, e) => {
8+
const _e = BigInt(e);
9+
const _m = BigInt(m);
10+
return _e > _m ? _e : _m;
11+
}, BigInt(0));
812

913
function maxSubsetSum(arr) {
1014
const arrCopy = arr.map(BigInt);

src/hackerrank/warmup/plusMinus.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ function plusMinus(arr) {
1717
}
1818
}
1919

20-
const result = [];
21-
22-
result.push((positives / arr.length).toFixed(6));
23-
result.push((negatives / arr.length).toFixed(6));
24-
result.push((zeros / arr.length).toFixed(6));
20+
const result = [
21+
(positives / arr.length).toFixed(6),
22+
(negatives / arr.length).toFixed(6),
23+
(zeros / arr.length).toFixed(6)
24+
];
2525

2626
return result.join(`\n`);
2727
}

0 commit comments

Comments
 (0)