You are viewing a single comment's thread. Return to all comments →
Kadane's max subArray sum
function maxSubArr(nums) { let current_max = nums[0], max_so_far = nums[0]; for (let i = 1; i < nums.length; i++){ current_max = Math.max(nums[i], current_max + nums[i]); max_so_far = Math.max(max_so_far, current_max); } return max_so_far; }
Seems like cookies are disabled on this browser, please enable them to open this website
The Maximum Subarray
You are viewing a single comment's thread. Return to all comments →
Kadane's max subArray sum