_3153

package
v0.0.0-...-5ea41ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 1 Imported by: 0

README

所有数对中数位差之和

你有一个数组 nums ,它只包含  整数,所有正整数的数位长度都 相同 。

两个整数的 数位差 指的是两个整数 相同 位置上不同数字的数目。

请你返回 nums 中 所有 整数对里,数位差之和。

示例 1:

**输入:**nums = [13,23,12]

**输出:**4

解释:

计算过程如下:

13 和 23 的数位差为 1 。

  • 13 和 12 的数位差为 1 。

23 和 12 的数位差为 2 。

所以所有整数数对的数位差之和为 1 + 1 + 2 = 4 。

示例 2:

**输入:**nums = [10,10,10,10]

**输出:**0

解释:

数组中所有整数都相同,所以所有整数数对的数位不同之和为 0 。

提示:

  • 2 <= nums.length <= 105
  • 1 <= nums[i] < 109
  • nums 中的整数都有相同的数位长度。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL