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

Commit930b934

Browse files
refactor 1209
1 parent74579b5 commit930b934

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

‎src/main/java/com/fishercoder/solutions/_1209.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,6 @@
22

33
importjava.util.Stack;
44

5-
/**
6-
* 1209. Remove All Adjacent Duplicates in String II
7-
*
8-
* Given a string s, a k duplicate removal consists of choosing k adjacent and equal
9-
* letters from s and removing them causing the left and the right side of the deleted substring to concatenate together.
10-
* We repeatedly make k duplicate removals on s until we no longer can.
11-
* Return the final string after all such duplicate removals have been made.
12-
* It is guaranteed that the answer is unique.
13-
*
14-
* Example 1:
15-
* Input: s = "abcd", k = 2
16-
* Output: "abcd"
17-
* Explanation: There's nothing to delete.
18-
*
19-
* Example 2:
20-
* Input: s = "deeedbbcccbdaa", k = 3
21-
* Output: "aa"
22-
* Explanation:
23-
* First delete "eee" and "ccc", get "ddbbbdaa"
24-
* Then delete "bbb", get "dddaa"
25-
* Finally delete "ddd", get "aa"
26-
*
27-
* Example 3:
28-
* Input: s = "pbbcggttciiippooaais", k = 2
29-
* Output: "ps"
30-
*
31-
* Constraints:
32-
* 1 <= s.length <= 10^5
33-
* 2 <= k <= 10^4
34-
* s only contains lower case English letters.
35-
* */
365
publicclass_1209 {
376
publicstaticclassSolution1 {
387
publicStringremoveDuplicates(Strings,intk) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp