[Python] Two Pointers - Prefix sum - CLEAN
\nclass Solution:\n    def maxSum(self, nums1: List[int], nums2: List[int]) -> int:\n        MODULO = 10**9 + 7\n        n1, n2 = len(nums1), len(nums2)\n      
```\nclass Solution:\n    def maxSum(self, nums1: List[int], nums2: List[int]) -> int:\n        MODULO = 10**9 + 7\n        n1, n2 = len(nums1), len(nums2)\n        i1, i2 = 0, 0\n        # Prefix sum leading up to the "jumping point". \n        # Reset to zero after the jump.\n        sum1, sum2 = 0, 0 \n        # The max score, summed up and modded\n        max_sum = 0\n        \n        while i1 < n1 or i2 < n2:\n            # If arr2 is exhausted or value at i1 is less than i2.\n            # Move the i1 pointer forward, add value at i1 to prefix sum1.\n            if i2 == n2 or (i1 < n1 and nums1[i1] < nums2[i2]):\n                sum1 += nums1[i1]\n                i1 += 1\n            # If arr1 is exhausted or value at i2 is less than i1.\n            # Move the i2 pointer forward, add value at i2 to prefix sum2.    \n            elif i1 == n1 or (i2 < n2 and nums2[i2] < nums1[i1]):\n                sum2 += nums2[i2]\n                i2 += 1\n            # Add the larger of the two prefix_sums to the max_sum.\n            # Advance both i1 and i2 pointers.    \n            else:\n                max_sum += max(sum1, sum2) + nums1[i1]\n                max_sum %= MODULO\n                sum1, sum2 = 0, 0 \n                i1 += 1\n                i2 += 1\n                \n        # Add the larger of the two suffix_sums to the results.    \n        max_sum += max(sum1, sum2)\n        return max_sum % MODULO\n```
['Two Pointers', 'Prefix Sum', 'Python']