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

Commit4410dca

Browse files
[LEET-3324] add 3324
1 parentbe32346 commit4410dca

File tree

3 files changed

+54
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src

3 files changed

+54
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| # | Title | Solutions | Video | Difficulty | Tag
22
|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|------------|----------------------------------------------------------------------
33
| 3330|[Find the Original Typed String I](https://leetcode.com/problems/find-the-original-typed-string-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3330.java)|| Easy|
4+
| 3324|[Find the Sequence of Strings Appeared on the Screen](https://leetcode.com/problems/find-the-sequence-of-strings-appeared-on-the-screen/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3324.java)|| Easy|
45
| 3318|[Find X-Sum of All K-Long Subarrays I](https://leetcode.com/problems/find-x-sum-of-all-k-long-subarrays-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3318.java)|| Easy|
56
| 3314|[Construct the Minimum Bitwise Array I](https://leetcode.com/problems/construct-the-minimum-bitwise-array-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3314.java)|| Easy|
67
| 3304|[Find the K-th Character in String Game I](https://leetcode.com/problems/find-the-k-th-character-in-string-game-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3304.java)|| Easy|
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
packagecom.fishercoder.solutions.fourththousand;
2+
3+
importjava.util.ArrayList;
4+
importjava.util.List;
5+
6+
publicclass_3324 {
7+
publicstaticclassSolution1 {
8+
publicList<String>stringSequence(Stringtarget) {
9+
List<String>ans =newArrayList<>();
10+
StringBuildersb =newStringBuilder();
11+
for (charc :target.toCharArray()) {
12+
charcandidate ='a';
13+
booleanfirstTime =true;
14+
do {
15+
if (firstTime) {
16+
firstTime =false;
17+
sb.append(candidate);
18+
}else {
19+
sb.setLength(sb.length() -1);
20+
candidate = (char) (candidate +1);
21+
sb.append(candidate);
22+
}
23+
ans.add(sb.toString());
24+
}while (c !=candidate);
25+
}
26+
returnans;
27+
}
28+
}
29+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
packagecom.fishercoder.fourththousand;
2+
3+
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
4+
5+
importcom.fishercoder.solutions.fourththousand._3324;
6+
importjava.util.Arrays;
7+
importorg.junit.jupiter.api.BeforeEach;
8+
importorg.junit.jupiter.api.Test;
9+
10+
publicclass_3324Test {
11+
private_3324.Solution1solution1;
12+
13+
@BeforeEach
14+
publicvoidsetup() {
15+
solution1 =new_3324.Solution1();
16+
}
17+
18+
@Test
19+
publicvoidtest1() {
20+
assertEquals(
21+
Arrays.asList("a","aa","ab","aba","abb","abc"),
22+
solution1.stringSequence("abc"));
23+
}
24+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp