Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1814. Count Nice Pairs in an Array
Count pairs i<j where nums[i] + rev(nums[j]) == nums[j] + rev(nums[i]); the condition is equivalent to nums[i] - rev(nums[i]) == nums[j] - rev(nums[j]), so the task reduces to counting pairs of indices with the same transformed value and returning the result mod 1e9+7. Constraints: n up to 1e5 and nums[i] up to 1e9.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.