File tree 1 file changed +0
-31
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-31
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .Stack ;
4
4
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
- * */
36
5
public class _1209 {
37
6
public static class Solution1 {
38
7
public String removeDuplicates (String s , int k ) {
You can’t perform that action at this time.
0 commit comments