Skip to content

Commit 38d774e

Browse files
committed
create 2390-removing-stars-from-a-string.cs
1 parent d7f9fc9 commit 38d774e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class Solution
2+
{
3+
public string RemoveStars(string s)
4+
{
5+
var output = new StringBuilder(s.Length);
6+
7+
foreach (var ch in s)
8+
{
9+
if (ch == '*')
10+
{
11+
output.Length--;
12+
}
13+
else
14+
{
15+
output.Append(ch);
16+
}
17+
}
18+
19+
return output.ToString();
20+
}
21+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy