1983. Widest Pair of Indices With Equal Range Sum
https://leetcode.com/problems/widest-pair-of-indices-with-equal-range-sum
Description
You are given two 0-indexed binary arrays nums1
and nums2
. Find the widest pair of indices (i, j)
such that i <= j
and nums1[i] + nums1[i+1] + ... + nums1[j] == nums2[i] + nums2[i+1] + ... + nums2[j]
.
The widest pair of indices is the pair with the largest distance between i
and j
. The distance between a pair of indices is defined as j - i + 1
.
Return the distance of the widest pair of indices. If no pair of indices meets the conditions, return 0
.
Example 1:
Example 2:
Example 3:
Constraints:
n == nums1.length == nums2.length
1 <= n <= 105
nums1[i]
is either0
or1
.nums2[i]
is either0
or1
.
ac
Previous1982. Find Array Given Subset SumsNext1984. Minimum Difference Between Highest and Lowest of K Scores
Last updated