Skip to content

Commit 32009a4

Browse files
committed
Fixed style
1 parent efd8333 commit 32009a4

File tree

1 file changed

+6
-6
lines changed
  • src/main/java/g3101_3200/s3153_sum_of_digit_differences_of_all_pairs

1 file changed

+6
-6
lines changed

src/main/java/g3101_3200/s3153_sum_of_digit_differences_of_all_pairs/Solution.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// #Medium #Array #Hash_Table #Math #Counting #2024_05_22_Time_12_ms_(100.00%)_Space_62.8_MB_(6.25%)
44

55
public class Solution {
6-
public long sumDigitDifferences(int[] nums) { // [1,2,12]
6+
public long sumDigitDifferences(int[] nums) {
77
long result = 0;
8-
while (nums[0] > 0) { // 13
9-
int[] counts = new int[10]; // [0,0,0,2,0,0,0,0,0,0]
10-
for (int i = 0; i < nums.length; i++) { // 12
11-
int digit = nums[i] % 10; // 2
12-
nums[i] = nums[i] / 10; // 1
8+
while (nums[0] > 0) {
9+
int[] counts = new int[10];
10+
for (int i = 0; i < nums.length; i++) {
11+
int digit = nums[i] % 10;
12+
nums[i] = nums[i] / 10;
1313
result += i - counts[digit];
1414
counts[digit]++;
1515
}

0 commit comments

Comments
 (0)