New update is available. Click here to update.
Close
Topic list
Maximum Subarray Sum
MEDIUM
35 mins
Dynamic Programming
Arrays
Topics (Covered in this problem)
Problem solved
Skill meter
Dynamic Programming
-
-
Arrays
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Greedy
-
-
Tries
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Maximum Subarray Sum

Contributed by
Achint Narang
Medium
0/80
Avg time to solve 35 mins
Success Rate 81 %
Share

## Problem Statement

#### A subarray is a contiguous segment of an array. In other words, a subarray can be formed by removing 0 or more integers from the beginning, and 0 or more integers from the end of an array.

##### Note :
``````The sum of an empty subarray is 0.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````9
1 2 7 -4 3 2 -10 9 1
``````
##### Sample Output 1 :
``````11
``````
##### Explanation for Sample 1 :
``````The subarray yielding maximum sum is [1, 2, 7, -4, 3, 2].
``````
##### Sample Input 2 :
``````6
10 20 -30 40 -50 60
``````
##### Sample Input 2 :
``````60
``````
##### Sample Input 3 :
``````3
-3 -5 -6
``````
##### Sample Input 3 :
``````0
``````
Auto
Console