Hint:
Use two variables: one to track the current sum and another to track the maximum sum.Update the maximum sum whenever the current sum exceeds it.If the current sum becomes negative, reset it to 0.
It looks like you're new here. If you want to get involved, click one of these buttons!