Skip to content

Commit d1d0bd2

Browse files
committed
--update: max2 initialization, return false if no pair found
1 parent 5aab5cc commit d1d0bd2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/_Problems_/find-2-nums-adding-to-n/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ function findTwoNumsAddingToN2(arr, number) {
2828
}
2929
}
3030

31-
return pair.length ? pair : null;
31+
return pair.length ? pair : false;
3232
}

src/_Problems_/find-2nd-max/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
function findSecondMax(arr) {
88
let max = arr[0];
9-
let max2 = 0;
9+
let max2 = Number.MIN_SAFE_INTEGER;
1010

1111
for (let el of arr) {
1212
if (el > max) {

0 commit comments

Comments
 (0)