Skip to content

Commit bb358ce

Browse files
committed
Fixed sonar
1 parent 8ece05d commit bb358ce

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/main/java/g3401_3500/s3484_design_spreadsheet/Spreadsheet.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
@SuppressWarnings("unused")
99
public class Spreadsheet {
10-
private final Map<String, Integer> spreadsheet = new HashMap<>();
10+
private final Map<String, Integer> data = new HashMap<>();
1111

1212
public Spreadsheet(int rows) {}
1313

1414
public void setCell(String cell, int value) {
15-
spreadsheet.put(cell, value);
15+
data.put(cell, value);
1616
}
1717

1818
public void resetCell(String cell) {
19-
spreadsheet.put(cell, 0);
19+
data.put(cell, 0);
2020
}
2121

2222
public int getValue(String formula) {
@@ -25,11 +25,11 @@ public int getValue(String formula) {
2525
String right = formula.substring(index + 1);
2626
int x =
2727
Character.isLetter(left.charAt(0))
28-
? spreadsheet.getOrDefault(left, 0)
28+
? data.getOrDefault(left, 0)
2929
: Integer.parseInt(left);
3030
int y =
3131
Character.isLetter(right.charAt(0))
32-
? spreadsheet.getOrDefault(right, 0)
32+
? data.getOrDefault(right, 0)
3333
: Integer.parseInt(right);
3434
return x + y;
3535
}

src/main/java/g3401_3500/s3486_longest_special_path_ii/Solution.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import java.util.List;
77

88
public class Solution {
9-
private int n;
10-
private final int maxVal = 50000;
9+
private final static int MAX_VAL = 50000;
1110
private int dupCount;
1211
private int overCount;
1312
private long ansLength;
@@ -19,7 +18,7 @@ public class Solution {
1918
private int[] freq;
2019

2120
public int[] longestSpecialPath(int[][] edges, int[] nums) {
22-
this.n = nums.length;
21+
int n = nums.length;
2322
this.nums = nums;
2423
adj = new ArrayList<>();
2524
for (int i = 0; i < n; i++) {
@@ -36,7 +35,7 @@ public int[] longestSpecialPath(int[][] edges, int[] nums) {
3635
// Preallocate DFS chain arrays
3736
path = new int[n];
3837
dist = new long[n];
39-
freq = new int[maxVal + 1];
38+
freq = new int[MAX_VAL + 1];
4039
ansLength = 0;
4140
ansNodes = Integer.MAX_VALUE;
4241
dupCount = 0;

0 commit comments

Comments
 (0)