Skip to content

dineshpanda/max_subarray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

This program is Ruby solution to find largest sum of contiguous sub-array and it is based on Kadane's algorithm.

Problem reference: https://en.wikipedia.org/wiki/Maximum_subarray_problem

Usage:

1. Clone this repo
2. Run the ruby program `ruby max_sub_array.rb`
3. Input: -2 1 -3 4 -1 2 1 -5 4
4. Output:
   Start Index: 3
   Length: 4
   Sum: 6
   Elements: [4, -1, 2, 1]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages