3761. Minimum Absolute Distance Between Mirror Pairs
You are given an integer array
nums.A mirror pair is a pair of indices
(i, j)such that:
0 <= i < j < nums.length, andreverse(nums[i]) == nums[j], wherereverse(x)denotes the integer formed by reversing the digits ofx. Leading zeros are omitted after reversing, for examplereverse(120) = 21.Return the minimum absolute distance between the indices of any mirror pair. The absolute distance between indices
iandjisabs(i - j).If no mirror pair exists, return
-1.
1 | class Solution { |