Get Maximum Score - Solution in Java 
Approach
Two-pointer technique:
Traverse both arrays simultaneously using two pointers i1 and i2.
Maintain two sums, s1 and s2, to track the cumulative sum of v
# Approach
- Two-pointer technique:
`Traverse both arrays simultaneously using two pointers i1 and i2.`
`Maintain two sums, s1 and s2, to track the cumulative sum of values in nums1 and nums2 until a common value is encountered.`
`When a common value is found, add the maximum of s1 and s2 to the result (max) and reset the sums.`
- After the traversal:
`Add the remaining elements of nums1 and nums2 to their respective sums.`
`Add the larger of the two remaining sums to the result.`
- Take the result modulo 10^9 + 7

# Complexity
- Time complexity:
    O(M+N)
- Space complexity:
    O(1)

# Code
```java []
class Solution {
    public int maxSum(int[] nums1, int[] nums2) {
        long s1=0, s2=0;
        int m=nums1.length;
        int n=nums2.length;
        int i1=0, i2=0;
        long max=0;

        while(i1!=m && i2!=n){
            if(nums1[i1]<nums2[i2]){
                s1+=nums1[i1];
                i1++;
            }
            else if(nums2[i2]<nums1[i1]){
                s2+=nums2[i2];
                i2++;
            }
            else if(nums1[i1]==nums2[i2]){
                max += Math.max(s1,s2) + nums1[i1];
                s1=0;
                s2=0;
                i1++;
                i2++;
            }
        }
        while(i1!=m){
            s1+=nums1[i1];
            i1++;
        }
        while(i2!=n){
            s2+=nums2[i2];
            i2++;
        }
        max+=Math.max(s1,s2);
    
    return ((int)(max%1000000007));
}
}
```
['Java']