solved MaximumSubarray step by step