Skip to content

Latest commit

 

History

History

Size of The Subarray With Maximum Sum

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

An array is given, find length of the subarray having maximum sum.

Examples : Input : a[] = {1, -2, 1, 1, -2, 1} Output : Length of the subarray is 2 Explanation: Subarray with consecutive elements and maximum sum will be {1, 1}. So length is 2

Input : ar[] = { -2, -3, 4, -1, -2, 1, 5, -3 } Output : Length of the subarray is 5 Explanation: Subarray with consecutive elements and maximum sum will be {4, -1, -2, 1, 5}.