When input is in increasing order

Give wrong answer when we give input in increasing order and sorted order like 1,2,3,4,5 give answer as 14 whereas it should be 15 in Maximum subarray 2