Skip to content

A Ruby program to find the contiguous subarray within a onedimensional array of numbers which has the largest sum.

Notifications You must be signed in to change notification settings

sakshi-keepworks/subarray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Largest sum contiguous subarray

A Ruby program to find the contiguous subarray within a onedimensional array of numbers (containing at least one positive number) which has the largest sum. For example,

for the sequence of values −2, 1, −3, 4, −1, 2, 1, −5, 4; the contiguous subarray with the largest sum is 4, −1, 2, 1, with sum 6.

The program runs as follows:

Enter the array : 2

1 3

4 1

2 1 5

4

Largest SubArray

Start Index: 3

Length: 4

Sum: 6

Elements: 4 1

2 1

About

A Ruby program to find the contiguous subarray within a onedimensional array of numbers which has the largest sum.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages