Skip to content

Fixed Idea warnings #1963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/g0001_0100/s0045_jump_game_ii/Solution.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Solution {
private int getMax(int[] nums, int l, int r) {
int max = -1;
int curr = -1;
int curr;
for (int i = l; i <= r; i++) {
curr = i + nums[i];
max = Math.max(max, curr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@SuppressWarnings("unchecked")
public class MyHashMap {
private ArrayList[] arr = null;
private final ArrayList[] arr;

public MyHashMap() {
arr = new ArrayList[1000];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

public class Solution {
public int sumBase(int n, int k) {
int a = 0;
int a;
int sum = 0;
int b = 0;
int b;
while (n != 0) {
a = n % k;
b = n / k;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public int latestTimeCatchTheBus(int[] buses, int[] passengers, int capacity) {
b++;
}
}
int start = 0;
int start;
if (c == capacity) {
// capcity is full in last bus, find time last passenger might have boarded
start = Math.min(passengers[p - 1], buses[blen - 1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Solution {
public int secondsToRemoveOccurrences(String s) {
int lastOne = -1;
int result = 0;
int prevResult = 0;
int prevResult;
int curResult = 0;
int countOne = 0;
int countZero = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ public String largestPalindromic(String num) {
for (char c : num.toCharArray()) {
count[c - '0']++;
}
int c = 0;
int c;
for (int i = 9; i >= 0; i--) {
c = 0;
if (count[i] % 2 == 1 && center == -1) {
center = i;
}
if (first.length() == 0 && i == 0) {
if (first.isEmpty() && i == 0) {
continue;
}
while (c < count[i] / 2) {
first.append(String.valueOf(i));
first.append(i);
c++;
}
}
second = new StringBuilder(first.toString());
if (center != -1) {
first.append(center);
}
first.append(second.reverse().toString());
return first.length() == 0 ? "0" : first.toString();
first.append(second.reverse());
return first.isEmpty() ? "0" : first.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Solution {
public int matchPlayersAndTrainers(int[] players, int[] trainers) {
Arrays.sort(players);
Arrays.sort(trainers);
int i = 0;
int i;
int j = 0;
int count = 0;
i = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@SuppressWarnings("java:S3518")
public class Solution {
public String[] splitMessage(String message, int limit) {
int total = 0;
int total;
int running = 0;
int count;
int totalReq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class Solution {
public int longestString(int x, int y, int z) {
int min = Math.min(x, y);
int res = 0;
int res;
if (x == y) {
res = 2 * min + z;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public int maximumSafenessFactor(List<List<Integer>> grid) {
int[] tmpDeque;
int[] queue = new int[yLen * xLen];
int[] root = new int[yLen * xLen];
int head = -1;
int head;
int tail = -1;
int qIdx = -1;
int end = yLen * xLen - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ListNode doubleIt(ListNode head) {

private ListNode revList(ListNode head) {
ListNode prev = null;
ListNode nxt = null;
ListNode nxt;
ListNode current = head;
while (current != null) {
nxt = current.next;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class Solution {
public int maximumStrongPairXor(int[] nums) {
int max = 0;
int pair = 0;
int pair;
for (int i = 0; i < nums.length; i++) {
for (int j = i; j < nums.length; j++) {
if (Math.abs(nums[i] - nums[j]) <= Math.min(nums[i], nums[j])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class Solution {
public long incremovableSubarrayCount(int[] nums) {
long ans = 0;
long ans;
int n = nums.length;
int l = 0;
int r = n - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public int[] minimumCost(int n, int[][] edges, int[][] query) {
if (parent1 == parent2) {
bitwise[parent1] &= weight;
} else {
int bitwiseVal = 0;
int bitwiseVal;
boolean check1 = bitwise[parent1] == -1;
boolean check2 = bitwise[parent2] == -1;
if (check1 && check2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

public class Solution {
private static final int MOD = (int) 1e9 + 7;
private long[] c2 = new long[1001];
private final long[] c2 = new long[1001];

public int subsequencesWithMiddleMode(int[] nums) {
if (c2[2] == 0) {
c2[0] = c2[1] = 0;
c2[2] = 1;
for (int i = 3; i < c2.length; ++i) {
c2[i] = i * (i - 1) / 2;
c2[i] = (long) i * (i - 1) / 2;
}
}
int n = nums.length;
Expand Down Expand Up @@ -59,8 +59,8 @@ public int subsequencesWithMiddleMode(int[] nums) {
ans -=
leftY
* rightY
* (leftX * (right - rightX - rightY)
+ rightX * (left - leftX - leftY));
* ((long) leftX * (right - rightX - rightY)
+ (long) rightX * (left - leftX - leftY));
}
}
leftCount[x]++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public boolean hasMatch(String s, String p) {
private int fun(String s, String k) {
int n = s.length();
int m = k.length();
int j = 0;
int j;
for (int i = 0; i <= n - m; i++) {
for (j = 0; j < m; j++) {
char ch1 = s.charAt(j + i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Solution {
public long minCost(int[] arr, int[] brr, long k) {
int n = arr.length;
long sum1 = 0;
long sum2 = 0;
long sum2;
for (int i = 0; i < n; i++) {
sum1 += Math.abs(arr[i] - brr[i]);
}
Expand Down