You are given an array of n integers. The task is to find the sum of the subarray which has the smallest possible sum.
Note: Subarray is an array formed by a block of contiguous elements of the parent ( or original ) array.
Examples
Input:
No. of elements in the array = 5
Array : -4 3 -1 -6 8
Output:
-8
Explanation: The subarray [-4, 3, -1, -6] gives the minimum sum.
Input:
No. of elements in the array = 5
Array : 3 5 1 2 4
Output:
1
Explanation: The subarray [1] gives the minimum sum.
A...
Published on October 12, 2020 14:21