Skip to content

Commit 61ee224

Browse files
authored
merge: Add test case to Find Second Largest Element Algorithm (TheAlgorithms#1037)
1 parent dbffac2 commit 61ee224

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { secondLargestElement } from '../FindSecondLargestElement'
2+
3+
test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => {
4+
const array = [1, 2, 3, 4, 5]
5+
const res = secondLargestElement(array)
6+
expect(res).toEqual(4)
7+
})
8+
9+
test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => {
10+
const array = [-1, -2, -3, -4, -5]
11+
const res = secondLargestElement(array)
12+
expect(res).toEqual(-2)
13+
})

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