Problem Explanation
Given an Array A, you have to give the maximum sum among all contiguous subsets of A where A_i is a not negative integer.
Approach
We iterate through the array and for every non-negative integer we encounter, we add it to a sum variable and set a maxsum variable to maximum of sum and maxsum. And if we encounter a negative integer, we reset the sum to 0.