| 1 | class KadaneAlgorithm { |
| 2 | maxSubArray(nums) { |
| 3 | let currentSum = nums[0]; |
| 4 | let maxSum = nums[0]; |
| 5 | |
| 6 | for (let i = 1; i < nums.length; i++) { |
| 7 | currentSum = Math.max(nums[i], currentSum + nums[i]); |
| 8 | maxSum = Math.max(maxSum, currentSum); |
| 9 | } |
| 10 | return maxSum; |
| 11 | } |
| 12 | } |
nothing calls this directly
no outgoing calls
no test coverage detected