53. Maximum Subarray Sum / Kadane
Problem Statement
Given an integer array nums
, find the
subarray with the largest sum, and return its sum.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= nums.length <= 105
-104 <= nums[i] <= 104
Intuition
Links
https://leetcode.com/problems/maximum-subarray/
Video Links
https://www.youtube.com/watch?v=w_KEocd__20&list=PLgUwDviBIf0rPG3Ictpu74YWBQ1CaBkm2&index=6
Approach 1:
C++
Approach 2:
C++
Approach 3:
C++
Approach 4:
C++
Similar Problems
Last updated