Max Contiguous Subarray Sum - Cubic Time To Kadane's Algorithm ("Maximum Subarray" on LeetCode)

Published: 01 February 2019
on channel: Back To Back SWE
233,368
8.5k

Code & Problem Statement @ https://backtobackswe.com/platform/co...

Free 5-Day Mini-Course: https://backtobackswe.com
Try Our Full Platform: https://backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions

Question: Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

Approaches Covered:

Approach 1 O(n^3) Time Solution
Approach 2 O(n^2) Time Solution
Approach 3 O(n) Solution (Kadane's Algorithm)
- - maxSum[i] = max( A[i], A[i] + maxSum[i - 1] )

++++++++++++++++++++++++++++++++++++++++++++++++++

HackerRank:    / @hackerrankofficial  

Tuschar Roy:    / tusharroy2525  

GeeksForGeeks:    / @geeksforgeeksvideos  

Jarvis Johnson:    / vsympathyv  

Success In Tech:    / @successintech  


Watch video Max Contiguous Subarray Sum - Cubic Time To Kadane's Algorithm ("Maximum Subarray" on LeetCode) online without registration, duration hours minute second in high quality. This video was added by user Back To Back SWE 01 February 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 233,368 once and liked it 8.5 thousand people.