Skip to content

Commit ed49e12

Browse files
committed
tried to fix tests
1 parent 5a59d1e commit ed49e12

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Diff for: Dynamic-Programming/KadaneAlgo.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Reference article :- https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/
1010
*/
1111

12-
function kadaneAlgo (array) {
12+
export function kadaneAlgo (array) {
1313
let cummulativeSum = 0
1414
let maxSum = Number.NEGATIVE_INFINITY // maxSum has the least posible value
1515
for (let i = 0; i < array.length; i++) {
@@ -23,4 +23,3 @@ function kadaneAlgo (array) {
2323
return maxSum
2424
// This function returns largest sum contiguous sum in a array
2525
}
26-
export { kadaneAlgo }

Diff for: Dynamic-Programming/tests/KadaneAlgo.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { kadaneAlgo } from '../KadaneAlgo'
22
test('it is being checked that 15 is the answer to the corresponding array input', () => {
3-
expect(fc.kadaneAlgo([1, 2, 3, 4, 5])).toBe(15)
3+
expect(kadaneAlgo([1, 2, 3, 4, 5])).toBe(15)
44
})
55

66
test('it is being checked that 5 is the answer to the corresponding array input', () => {
7-
expect(fc.kadaneAlgo([-1, -2, -3, -4, 5])).toBe(5)
7+
expect(kadaneAlgo([-1, -2, -3, -4, 5])).toBe(5)
88
})

0 commit comments

Comments
 (0)