Given an array of size n, containing positive and negative integers, find the longest sub-array such that the sum of the elements in the sub-array is the maximum.

For example,

Given array :

10, 8, -5, 1, -27, 5, 7, -5, 11

the sub array should be : 10, 8

Source : CLRS & this sample interview question

Subscribe to:
Post Comments (Atom)

## 1 comment:

2D Kadane's algo question would have been more interesting than 1D.

Post a Comment