Maximum Subarray
Problem
Given an integer array
nums
, find the subarray which has the largest sum and return its sum.
Example 1:
Example 2:
Example 3:
Pseudocode
Solution
Time and Space Complexity
Time
Iterate thorugh nums array - O(N)
Total - O(N)
Space
Storing summation values, previous and maximum - O(1)
Total - O(1)
Last updated