Merge pull request #1794 from LookSin/new-commit

1047.Java第二种解法,可以优化成速度更快的
This commit is contained in:
程序员Carl
2022-12-20 10:58:51 +08:00
committed by GitHub

View File

@ -153,6 +153,8 @@ class Solution {
class Solution {
public String removeDuplicates(String s) {
// 将 res 当做栈
// 也可以用 StringBuilder 来修改字符串,速度更快
// StringBuilder res = new StringBuilder();
StringBuffer res = new StringBuffer();
// top为 res 的长度
int top = -1;
@ -470,3 +472,4 @@ impl Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>