Skip to content

Commit

Permalink
create 2390-removing-stars-from-a-string.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
NotADucc committed Oct 11, 2024
1 parent d7f9fc9 commit 38d774e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions csharp/2390-removing-stars-from-a-string.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class Solution
{
public string RemoveStars(string s)
{
var output = new StringBuilder(s.Length);

foreach (var ch in s)
{
if (ch == '*')
{
output.Length--;
}
else
{
output.Append(ch);
}
}

return output.ToString();
}
}

0 comments on commit 38d774e

Please sign in to comment.