Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0725cdb

Browse files
add 1910
1 parente99f831 commit0725cdb

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1910|[Remove All Occurrences of a Substring](https://leetcode.com/problems/remove-all-occurrences-of-a-substring/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1904.java)||Medium|String|
1112
|1904|[The Number of Full Rounds You Have Played](https://leetcode.com/problems/the-number-of-full-rounds-you-have-played/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1904.java)||Medium|String, Greedy|
1213
|1903|[Largest Odd Number in String](https://leetcode.com/problems/largest-odd-number-in-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1903.java)||Easy|Greedy|
1314
|1897|[Redistribute Characters to Make All Strings Equal](https://leetcode.com/problems/redistribute-characters-to-make-all-strings-equal/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1897.java)||Easy|String, Greedy|
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1910 {
4+
publicstaticclassSolution1 {
5+
publicStringremoveOccurrences(Strings,Stringpart) {
6+
StringBuildersb =newStringBuilder();
7+
for (inti =0;i <s.length();i++) {
8+
sb.append(s.charAt(i));
9+
if (sb.length() >=part.length()) {
10+
if (sb.substring(sb.length() -part.length()).equals(part)) {
11+
sb.setLength(sb.length() -part.length());
12+
}
13+
}
14+
}
15+
returnsb.toString();
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp