count to 0.i ranging from 0 to len(nums) - 1 and the inner loop index j ranging from i + 1 to len(nums).i, find the first digit by dividing nums[i] by 10 until it is less than 10.j, find the last digit by taking nums[j] % 10.count by 1.count.