Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /