Skip to content

Commit dbffac2

Browse files
appgurueugithub-actions
andauthored
merge: FindSecondLargestElement: Support negative numbers (TheAlgorithms#1036)
* FindSecondLargestElement: Support negative numbers * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 0dccd28 commit dbffac2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

DIRECTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
* [BinaryExponentiationRecursive](Maths/BinaryExponentiationRecursive.js)
143143
* [BisectionMethod](Maths/BisectionMethod.js)
144144
* [CheckKishnamurthyNumber](Maths/CheckKishnamurthyNumber.js)
145+
* [CollatzSequence](Maths/CollatzSequence.js)
145146
* [Coordinate](Maths/Coordinate.js)
146147
* [CoPrimeCheck](Maths/CoPrimeCheck.js)
147148
* [DecimalExpansion](Maths/DecimalExpansion.js)
@@ -159,13 +160,15 @@
159160
* [FigurateNumber](Maths/FigurateNumber.js)
160161
* [FindHcf](Maths/FindHcf.js)
161162
* [FindLcm](Maths/FindLcm.js)
163+
* [FindMaxRecursion](Maths/FindMaxRecursion.js)
162164
* [FindMin](Maths/FindMin.js)
163165
* [FindMinIterator](Maths/FindMinIterator.js)
164166
* [GetEuclidGCD](Maths/GetEuclidGCD.js)
165167
* [GridGet](Maths/GridGet.js)
166168
* [IsDivisible](Maths/IsDivisible.js)
167169
* [IsEven](Maths/IsEven.js)
168170
* [IsOdd](Maths/IsOdd.js)
171+
* [IsPronic](Maths/IsPronic.js)
169172
* [LeapYear](Maths/LeapYear.js)
170173
* [LinearSieve](Maths/LinearSieve.js)
171174
* [LucasSeries](Maths/LucasSeries.js)
@@ -197,6 +200,7 @@
197200
* [SquareRoot](Maths/SquareRoot.js)
198201
* [SumOfDigits](Maths/SumOfDigits.js)
199202
* [SumOfGeometricProgression](Maths/SumOfGeometricProgression.js)
203+
* [TwinPrime](Maths/TwinPrime.js)
200204
* [Volume](Maths/Volume.js)
201205
* [WhileLoopFactorial](Maths/WhileLoopFactorial.js)
202206
* [ZellersCongruenceAlgorithm](Maths/ZellersCongruenceAlgorithm.js)

Sorts/FindSecondLargestElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
const secondLargestElement = (array) => {
1313
const largestElement = Math.max(...array)
14-
let element = 0
14+
let element = -Number.MAX_VALUE
1515

1616
for (let i = 0; i < array.length; i++) {
1717
if (element < array[i] && array[i] !== largestElement) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy