Skip to content

Commit 37ef1ea

Browse files
authored
Added task 3374
1 parent d21e0ea commit 37ef1ea

File tree

16 files changed

+99
-19
lines changed
  • src/main/java
    • g0001_0100
    • g0201_0300/s0282_expression_add_operators
    • g0401_0500
    • g0501_0600/s0520_detect_capital
    • g0601_0700/s0664_strange_printer
    • g0701_0800/s0761_special_binary_string
    • g1001_1100/s1002_find_common_characters
    • g1101_1200/s1138_alphabet_board_path
    • g1701_1800/s1704_determine_if_string_halves_are_alike
    • g1801_1900/s1898_maximum_number_of_removable_characters
    • g1901_2000/s1948_delete_duplicate_folders_in_system
    • g3301_3400/s3374_first_letter_capitalization_ii

16 files changed

+99
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,7 @@
18161816

18171817
| # | Title | Difficulty | Tag | Time, ms | Time, %
18181818
|------|----------------|-------------|-------------|----------|--------
1819+
| 3374 |[First Letter Capitalization II](src/main/java/g3301_3400/s3374_first_letter_capitalization_ii)| Hard | Database | 261 | 84.21
18191820
| 3373 |[Maximize the Number of Target Nodes After Connecting Trees II](src/main/java/g3301_3400/s3373_maximize_the_number_of_target_nodes_after_connecting_trees_ii)| Hard | Depth_First_Search, Breadth_First_Search, Tree | 26 | 98.75
18201821
| 3372 |[Maximize the Number of Target Nodes After Connecting Trees I](src/main/java/g3301_3400/s3372_maximize_the_number_of_target_nodes_after_connecting_trees_i)| Medium | Depth_First_Search, Breadth_First_Search, Tree | 50 | 99.49
18211822
| 3371 |[Identify the Largest Outlier in an Array](src/main/java/g3301_3400/s3371_identify_the_largest_outlier_in_an_array)| Medium | Array, Hash_Table, Counting, Enumeration | 5 | 100.00

src/main/java/g0001_0100/s0014_longest_common_prefix/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class Solution {
4343
String temp = strs[0];
4444
int i = 1;
4545
String cur;
46-
while (temp.length() > 0 && i < strs.length) {
46+
while (!temp.isEmpty() && i < strs.length) {
4747
if (temp.length() > strs[i].length()) {
4848
temp = temp.substring(0, strs[i].length());
4949
}

src/main/java/g0001_0100/s0065_valid_number/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Given a string `s`, return `true` _if_ `s` _is a **valid number**_.
6161
```java
6262
public class Solution {
6363
public boolean isNumber(String s) {
64-
if (s == null || s.length() == 0) {
64+
if (s == null || s.isEmpty()) {
6565
return false;
6666
}
6767
boolean eSeen = false;

src/main/java/g0201_0300/s0282_expression_add_operators/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import java.util.List;
7171
public class Solution {
7272
public List<String> addOperators(String num, int target) {
7373
List<String> res = new ArrayList<>();
74-
if (num.length() == 0 || Long.parseLong(num) > Integer.MAX_VALUE) {
74+
if (num.isEmpty() || Long.parseLong(num) > Integer.MAX_VALUE) {
7575
return res;
7676
}
7777
char[] list = num.toCharArray();

src/main/java/g0401_0500/s0434_number_of_segments_in_a_string/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ A **segment** is defined to be a contiguous sequence of **non-space characters**
3535
public class Solution {
3636
public int countSegments(String s) {
3737
s = s.trim();
38-
if (s.length() == 0) {
38+
if (s.isEmpty()) {
3939
return 0;
4040
}
4141
String[] splitted = s.split(" ");
4242
int result = 0;
4343
for (String value : splitted) {
44-
if (value.length() > 0) {
44+
if (!value.isEmpty()) {
4545
result++;
4646
}
4747
}

src/main/java/g0401_0500/s0468_validate_ip_address/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class Solution {
5252
private static final String NEITHER = "Neither";
5353

5454
public String validIPAddress(String ip) {
55-
if (ip.length() == 0) {
55+
if (ip.isEmpty()) {
5656
return NEITHER;
5757
}
5858
String[] arr = ip.split("\\.", -1);
@@ -70,7 +70,7 @@ public class Solution {
7070
return "IPv4";
7171
} else if (arr1.length == 8) {
7272
for (String num : arr1) {
73-
if (num.length() < 1 || num.length() > 4) {
73+
if (num.isEmpty() || num.length() > 4) {
7474
return NEITHER;
7575
}
7676
for (int j = 0; j < num.length(); j++) {

src/main/java/g0401_0500/s0488_zuma_game/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public class Solution {
8484
}
8585

8686
private int findMinStepDp(String board, String hand, Map<String, Map<String, Integer>> dp) {
87-
if (board.length() == 0) {
87+
if (board.isEmpty()) {
8888
return 0;
8989
}
90-
if (hand.length() == 0) {
90+
if (hand.isEmpty()) {
9191
return -1;
9292
}
9393
if (dp.get(board) != null && dp.get(board).get(hand) != null) {

src/main/java/g0501_0600/s0520_detect_capital/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Given a string `word`, return `true` if the usage of capitals in it is right.
3535
```java
3636
public class Solution {
3737
public boolean detectCapitalUse(String word) {
38-
if (word == null || word.length() == 0) {
38+
if (word == null || word.isEmpty()) {
3939
return false;
4040
}
4141
int upper = 0;

src/main/java/g0601_0700/s0664_strange_printer/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Given a string `s`, return _the minimum number of turns the printer needed to pr
3838
```java
3939
public class Solution {
4040
public int strangePrinter(String s) {
41-
if (s.length() == 0) {
41+
if (s.isEmpty()) {
4242
return 0;
4343
}
4444
int[][] dp = new int[s.length()][s.length()];

src/main/java/g0701_0800/s0761_special_binary_string/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import java.util.PriorityQueue;
4646

4747
public class Solution {
4848
public String makeLargestSpecial(String s) {
49-
if (s == null || s.length() == 0 || s.length() == 2) {
49+
if (s == null || s.isEmpty() || s.length() == 2) {
5050
return s;
5151
}
5252
PriorityQueue<String> pq = new PriorityQueue<>((a, b) -> b.compareTo(a));
@@ -72,7 +72,7 @@ public class Solution {
7272
while (!pq.isEmpty()) {
7373
ans.append(pq.poll());
7474
}
75-
if (ans.length() == 0) {
75+
if (ans.isEmpty()) {
7676
ans.append('1');
7777
ans.append(makeLargestSpecial(s.substring(1, s.length() - 1)));
7878
ans.append('0');

0 commit comments

Comments
 (0)