MaxSubarray problem--- commonly asked in coding interviews