Find Number of Valid Pairs
Problem Overview
- Count pairs of indices (i, j) with i < j where a[i] − b[j] equals a[j] − b[i].
- Input: two same-length lists a and b; Output: the number of valid pairs; constraints not specified.
- Context: balancing cross-differences when comparing two datasets or signals.
- From Roblox interviews; a classic coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
