<jupyter_start><jupyter_text>给定一个整数数组nums，找到具有最大和的连续子数组（至少包含一个数字）并返回其和。        例1：        Input: [-2,1,-3,4,-1,2,1,-5,4],        Output: 6        Explanation: [4,-1,2,1] has the largest sum = 6.<jupyter_code>class Solution:
    def maxSubArray(self, nums) -> int:
        if len(nums) <= 1: return sum(nums)
        opt = len(nums) * [0]
        opt[0] = nums[0]
        for i in range(1, len(nums)):
            a_way = opt[i - 1] + nums[i]
            b_way = nums[i]
            opt[i] = max(a_way, b_way)
        return max(opt)
nums_ = [-2,1,-3,4,-1, 2,1,-5,4]
solution = Solution()
solution.maxSubArray(nums_)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17209302325581396, 'fraction_numerical': 0.04806201550387597, 'mean_word_length': 2.510869565217391, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '228649', 'license': 'Apache-2.0', 'n_tokens_mistral': 297, 'n_tokens_neox': 297, 'n_words': 50, 'path': 'Dynamic Programming/past/53. Maximum Subarray.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '645'}