Skip to content

Commit 593c7dc

Browse files
committed
Fixed idea warnings.
1 parent 1243172 commit 593c7dc

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

src/main/java/g0101_0200/s0125_valid_palindrome/Solution.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ public boolean isPalindrome(String s) {
99
// Iterates through string to find first char which is alphanumeric.
1010
// Done to ignore non-alphanumeric characters.
1111
// Starts from 0 to j-1.
12-
while (i < j && !isAlphaNumeric(s.charAt(i))) {
12+
while (i < j && isNotAlphaNumeric(s.charAt(i))) {
1313
i++;
1414
}
1515
// Similarly from j-1 to 0.
16-
while (i < j && !isAlphaNumeric(s.charAt(j))) {
16+
while (i < j && isNotAlphaNumeric(s.charAt(j))) {
1717
j--;
1818
}
1919
// Checks if i is greater than or equal to j.
@@ -39,8 +39,8 @@ public boolean isPalindrome(String s) {
3939
return res;
4040
}
4141

42-
private boolean isAlphaNumeric(char c) {
43-
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
42+
private boolean isNotAlphaNumeric(char c) {
43+
return (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9');
4444
}
4545

4646
private boolean isUpper(char c) {

src/main/java/g0201_0300/s0211_design_add_and_search_words_data_structure/WordDictionary.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public boolean search(String word) {
3131
for (String s : a) {
3232
boolean match = true;
3333
for (int i = 0; i < word.length() && match; i++) {
34-
if (word.charAt(i) == '.') {
35-
continue;
36-
} else if (s.charAt(i) != word.charAt(i)) {
34+
if (word.charAt(i) != '.' && s.charAt(i) != word.charAt(i)) {
3735
match = false;
3836
}
3937
}

src/main/java/g0201_0300/s0218_the_skyline_problem/Solution.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.ArrayList;
44
import java.util.Arrays;
5-
import java.util.Collections;
65
import java.util.List;
76
import java.util.TreeMap;
87

@@ -14,7 +13,7 @@ public List<List<Integer>> getSkyline(int[][] buildings) {
1413
lines.add(new int[] {building[0], building[2]});
1514
lines.add(new int[] {building[1], -building[2]});
1615
}
17-
Collections.sort(lines, (a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
16+
lines.sort((a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
1817
TreeMap<Integer, Integer> map = new TreeMap<>();
1918
map.put(0, 1);
2019
int prev = 0;

src/main/java/g0201_0300/s0236_lowest_common_ancestor_of_a_binary_tree/Solution.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
2727
if (left != null) {
2828
return left;
2929
}
30-
if (right != null) {
31-
return right;
32-
}
33-
return null;
30+
return right;
3431
}
3532
}

0 commit comments

Comments
 (0)