merge: Add test case to Find Second Largest Element Algorithm (#1037)

This commit is contained in:
Ankush263
2022-06-05 08:51:58 +05:30
committed by GitHub
parent dbffac253d
commit 61ee22459b

View File

@ -0,0 +1,13 @@
import { secondLargestElement } from '../FindSecondLargestElement'
test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => {
const array = [1, 2, 3, 4, 5]
const res = secondLargestElement(array)
expect(res).toEqual(4)
})
test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => {
const array = [-1, -2, -3, -4, -5]
const res = secondLargestElement(array)
expect(res).toEqual(-2)
})