A simple solution is to traverse the array and keep track of the maximum sum encountered so far. This can be done using the following approach: 
Iterate through the array and for each element, update the maximum sum encountered so far.

At any point, the maximum sum encountered so far is either the element itself or the sum of the previous maximum sum and the current element.

Thus, the algorithm can be recursively defined as follows: 
maxSum(i) = max(arr[i], maxSum(i-1)+arr[i])

Where maxSum(i) represents the maximum sum with arr[i] as the last element and arr[0...i] as the given array.
[1,2,3,4]
Specificare un algoritmo per trovare la somma massima in un dato array.