Python Solution
Runtime: 544 ms, faster than 99.46% of Python3 online submissions for Get the Maximum Score.\n* Memory Usage: 27.3 MB, less than 41.85% of Python3 online submis
* Runtime: 544 ms, faster than 99.46% of Python3 online submissions for Get the Maximum Score.\n* Memory Usage: 27.3 MB, less than 41.85% of Python3 online submissions for Get the Maximum Score.\n```\nclass Solution:\n    def maxSum(self, nums1: List[int], nums2: List[int]) -> int:\n        from bisect import bisect\n        common=sorted(set(nums1)&set(nums2))\n        if(not common):\n            return max(sum(nums1),sum(nums2))%(10**9+7)\n        else:\n            ret = 0\n            i1 = 0\n            i2 = 0\n            for c in common:\n                j1 = bisect(nums1,c,i1)\n                j2 = bisect(nums2,c,i2)\n                ret += max(sum(nums1[i1:j1]),sum(nums2[i2:j2]))\n                i1 = j1\n                i2 = j2\n            ret += max(sum(nums1[i1:]),sum(nums2[i2:]))\n            return ret%(10**9+7)\n```\n
[]