Maximum subarray sum on a given segment - Course 4