You are given a nums.
A pair of indices (i, j) is considered beautiful if nums.length and the first digit of nums[i] and the last digit of nums[j] are coprime.
Return the total number of beautiful pairs in nums.
Note: Two integers
and are coprime if , where denotes the greatest common divisor of and .
Constraints:
nums.length
nums[i]
nums[i] % 10
You are given a nums.
A pair of indices (i, j) is considered beautiful if nums.length and the first digit of nums[i] and the last digit of nums[j] are coprime.
Return the total number of beautiful pairs in nums.
Note: Two integers
and are coprime if , where denotes the greatest common divisor of and .
Constraints:
nums.length
nums[i]
nums[i] % 10