Skip to content

Commit

Permalink
Time: 28 ms (53.68%), Space: 7.7 MB (50.65%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
hovanhoa committed Oct 2, 2024
1 parent e391778 commit 77f4f42
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
func removeStars(s string) string {
var stack []byte
for _, v := range s {
ans := []byte{}
for _, v := range []byte(s) {
if v == '*' {
stack = stack[:len(stack) - 1]
ans = ans[:len(ans)-1]
} else {
stack = append(stack, byte(v))
ans = append(ans, v)
}
}
}

return string(stack)
return string(ans)
}

0 comments on commit 77f4f42

Please sign in to comment.