Search
⌘K
Get Premium
Leetcode 2748. Number of Beautiful Pairs
Count the number of index pairs i < j such that the first digit of nums[i] and the last digit of nums[j] are coprime (gcd == 1). Reduce each number to its leading and trailing digit (digits ∈ 1..9) and count pairs satisfying the coprimality condition.
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.