In-class assignment: Max subarray sum algorithm