Python 100,100  O(2*min(n,m)), O(1) simple with explanation
Logic:\nkeep two values v1,v2 which represent the max value of ending on that list\ni.e.:\nl1=[1,2,3,6] -> ending on l1 will give a max end val of v1=sum(5,4,3,
Logic:\nkeep two values v1,v2 which represent the max value of ending on that list\ni.e.:\nl1=[1,2,3,6] -> ending on l1 will give a max end val of v1=sum(5,4,3,2,1)\nl2=[3,4,5] -> ending on l2 will give a max end val of v2=sum(5,4,3)\n\nwhile both lists are not empty:\n\t1. if end vals not the same remove the largest ending element and add it to the corresponding value representing that list\n\t2. if the values are the same then set v1,v2 to the max of v1,v2 + the number (that is the same)\n\t\nfinally sum the remaining non-empty list to it\'s value\n\nresponse is max of v1,v2.\n\n\n```\nclass Solution:\n    def maxSum(self, nums1: List[int], nums2: List[int]) -> int:\n        v1=v2=0\n        while nums2 and nums1:\n            if nums1[-1]>nums2[-1]:\n                v1+=nums1.pop()\n            elif nums1[-1]<nums2[-1]:\n                v2+=nums2.pop()\n            else:\n                v1=v2=max(v1,v2)+nums1.pop()\n                nums2.pop()\n        v2+=sum(nums2)\n        v1+=sum(nums1)\n        return max(v1,v2)%1000000007\n```
[]