Ezvor

1983. Widest Pair of Indices With Equal Range Sum

MediumArray Preparing judge… LeetCode
ArrayHash TablePrefix Sum

Hints

Hint 1
Keep prefix sums of both arrays.
Hint 2
Can the difference between the prefix sums at an index help us?
Hint 3
What happens if the difference between the two prefix sums at an index a is x, and x again at a different index b?
Hint 4
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.