mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
Merge pull request #1794 from LookSin/new-commit
1047.Java第二种解法,可以优化成速度更快的
This commit is contained in:
@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user