Maximum sum subarray

what if all the given elements are negative and then we have to find the maximum sum in a subarray?

@Utkarsh-Malik-2768247316535340 you can use kadane algorithm but there is small modification required so that it can calculate maximum negative sum also if you apply normal kadane algorithm the maximum subarray sum always be 0