Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Keep prefix sums of both arrays.
Can the difference between the prefix sums at an index help us?
What happens if the difference between the two prefix sums at an index a is x, and x again at a different index b?
This means that the sum of nums1 from index a + 1 to index b is equal to the sum of nums2 from index a + 1 to index b.