Practice Number of Pairs Satisfying Inequality
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#2426
LeetCode ProblemNumber of Pairs Satisfying Inequality
Problem Statement
Count index pairs 0 <= i < j < nums1.length satisfying nums1[i] - nums1[j] <= nums2[i] - nums2[j] + diff. The two arrays have equal length. Return the count.
Source: Number of Pairs Satisfying Inequality on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums1 = [3,2,5], nums2 = [2,2,1], diff = 1
Output
3
# Example 2
Input
nums1 = [3,-1], nums2 = [-2,2], diff = -1
Output
0
Constraints
n == nums1.length == nums2.length
2 <= n <= 10^5
-10^4 <= nums1[i], nums2[i] <= 10^4
-10^4 <= diff <= 10^4
Related LeetCode Problems
Practice more problems similar to Number of Pairs Satisfying Inequality.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.