Added MaxSubArray function and tests