Algorithm to find largest and smallest summing sub-array from an array
0
/
1814
Algorithm to find largest and smallest summing sub-array from given array
Problem Statement: – Given an Array A of numbers, find sub-arrays (array slices) with the largest and smallest sum of their numbers. For eg; consider the below array [1,2,3] – In this array, the largest sum array slice is [3] and smallest sum array slice is [1]. Your program will be given an array as input, your job is to find all permutations of sub-arrays possible out of that array and print sub-arrays with largest and smallest sums. One of the various possible solutions to this problem is given below:-ID provided is not a Gistpen repo.
Below iframe will show the output of the html code embedded in this post.
Just click on generate button above to see the output of the above code.
Any suggestions, to improve this approach are most welcome. We want to create interactive sessions around our tech blogs.