Leetcode 3649. Number of Perfect Pairs
Count the number of index pairs (i<j) for which the absolute sum/difference of the pair satisfies both min(|a−b|,|a+b|) ≤ min(|a|,|b|) and max(|a−b|,|a+b|) ≥ max(|a|,|b|). The challenge is to algebraically characterize these absolute-value conditions so you can count qualifying pairs efficiently (n up to 1e5) rather than testing all O(n^2) pairs.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Late July, 2026
Meta
Junior
Online Assessment
Hello Interview Premium
Your account is free and you can post anonymously if you choose.