Skip to content

Commit 3c3a5d1

Browse files
fix styles
1 parent aa47d89 commit 3c3a5d1

File tree

10 files changed

+23
-20
lines changed

10 files changed

+23
-20
lines changed

src/main/java/com/fishercoder/solutions/_1844.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ public String replaceDigits(String s) {
1414
return sb.toString();
1515
}
1616
}
17+
1718
public static class Solution2 {
1819
public String replaceDigits(String s) {
19-
char inpArr[] = s.toCharArray();
20+
char[] inpArr = s.toCharArray();
2021
for (int i = 1; i < inpArr.length; i += 2) {
2122
inpArr[i] = (char) (inpArr[i - 1] + inpArr[i] - '0');
2223
}

src/main/java/com/fishercoder/solutions/_1891.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class Solution1 {
88
* My completely original solution on 1/27/2022.
99
*/
1010
public int maxLength(int[] ribbons, int k) {
11-
long sum = 0l;
11+
long sum = 0L;
1212
int max = ribbons[0];
1313
for (int num : ribbons) {
1414
sum += num;

src/main/java/com/fishercoder/solutions/_2325.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public String decodeMessage(String key, String message) {
3939

4040
Map<Character, Character> bucket = new HashMap<>();
4141
char ch = 'a';
42-
char keyArr[] = key.toCharArray();
42+
char[] keyArr = key.toCharArray();
4343
StringBuilder result = new StringBuilder();
4444

4545
for (int i = 0; i < keyArr.length; i++) {
@@ -49,7 +49,7 @@ public String decodeMessage(String key, String message) {
4949
}
5050

5151
// decode the message using the bucket
52-
char msgArr[] = message.toCharArray();
52+
char[] msgArr = message.toCharArray();
5353
for (int i = 0; i < msgArr.length; i++) {
5454
if (msgArr[i] == ' ') {
5555
result.append(" ");

src/main/java/com/fishercoder/solutions/_2455.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class _2455 {
44
public static class Solution1 {
55
public int averageValue(int[] nums) {
6-
Long sum = 0l;
6+
Long sum = 0L;
77
int count = 0;
88
for (int num : nums) {
99
if (num % 3 == 0 && num % 2 == 0) {

src/main/java/com/fishercoder/solutions/_2525.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
public class _2525 {
44
public static class Solution1 {
55
public String categorizeBox(int length, int width, int height, int mass) {
6-
int DIMENSION_LIMIT = 10000;
7-
int VOLUME_LIMIT = 1000000000;
6+
int dimensionLimit = 10000;
7+
int volumeLimit = 1000000000;
88
boolean isBulky = false;
99
long volume = (long) length * width * height;
10-
if (length >= DIMENSION_LIMIT || width >= DIMENSION_LIMIT || height >= DIMENSION_LIMIT || volume >= VOLUME_LIMIT) {
10+
if (length >= dimensionLimit || width >= dimensionLimit || height >= dimensionLimit || volume >= volumeLimit) {
1111
isBulky = true;
1212
}
1313
boolean isHeavy = mass >= 100;

src/main/java/com/fishercoder/solutions/_2535.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
public class _2535 {
44
public static class Solution1 {
55
public int differenceOfSum(int[] nums) {
6-
long elementSum = 0l;
7-
long digitSum = 0l;
6+
long elementSum = 0L;
7+
long digitSum = 0L;
88
for (int num : nums) {
99
elementSum += num;
1010
while (num != 0) {

src/main/java/com/fishercoder/solutions/_2558.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public long pickGifts(int[] gifts, int k) {
1313
int max = maxHeap.poll();
1414
maxHeap.offer((int) Math.sqrt(max));
1515
}
16-
long res = 0l;
16+
long res = 0L;
1717
while (!maxHeap.isEmpty()) {
1818
res += maxHeap.poll();
1919
}

src/main/java/com/fishercoder/solutions/_2583.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public long kthLargestLevelSum(TreeNode root, int k) {
1212
queue.offer(root);
1313
while (!queue.isEmpty()) {
1414
int size = queue.size();
15-
long thisSum = 0l;
15+
long thisSum = 0L;
1616
for (int i = 0; i < size; i++) {
1717
TreeNode curr = queue.poll();
1818
thisSum += curr.val;

src/main/java/com/fishercoder/solutions/_528.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ public Solution1(int[] w) {
1818
public int pickIndex() {
1919
int len = preSums.length;
2020
int idx = random.nextInt(preSums[len - 1]) + 1;
21-
int left = 0, right = len - 1;
21+
int left = 0;
22+
int right = len - 1;
2223
// search position
2324
while (left < right) {
2425
int mid = left + (right - left) / 2;
25-
if (preSums[mid] == idx)
26+
if (preSums[mid] == idx) {
2627
return mid;
27-
else if (preSums[mid] < idx)
28+
} else if (preSums[mid] < idx) {
2829
left = mid + 1;
29-
else
30+
} else {
3031
right = mid;
32+
}
3133
}
3234
return left;
3335
}

src/main/java/com/fishercoder/solutions/_54.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public List<Integer> spiralOrder(int[][] matrix) {
5959
while (ans.size() < total) {
6060
for (; i < m && i >= lowerRow && j < n && j >= lowerCol; ) {
6161
ans.add(matrix[i][j]);
62-
if (direction == 0) {//east
62+
if (direction == 0) { //east
6363
j++;
64-
} else if (direction == 1) {//south
64+
} else if (direction == 1) { //south
6565
i++;
66-
} else if (direction == 2) {//west
66+
} else if (direction == 2) { //west
6767
j--;
6868
} else {
69-
i--;//north
69+
i--; //north
7070
}
7171
}
7272
if (direction == 0) {

0 commit comments

Comments
 (0)