Skip to content

Latest commit

 

History

History

Smallest Sum Contiguous Subarray

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given an array containing n integers. The problem is to find the sum of the elements of the contiguous subarray having the smallest(minimum) sum.

Input : arr[] = {3, -4, 2, -3, -1, 7, -5}
Output : -6
Subarray is {-4, 2, -3, -1} = -6

Input : arr = {2, 6, 8, 1, 4}
Output : 1