Skip to content

Commit

Permalink
Merge pull request #3669 from NotADucc/2390
Browse files Browse the repository at this point in the history
create 2390-removing-stars-from-a-string.cs
  • Loading branch information
Ykhan799 authored Oct 12, 2024
2 parents fd1d112 + 38d774e commit 9f0d820
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 9f0d820

Please sign in to comment.