Комментарии:
Sir please give me this problem solution without taking contain method
ОтветитьThank you
ОтветитьSimple:
string str = "Something @to ,Write.;';";
str = string.Join("", str.Split('@', ',', '.', ';', '\''));
But string.contains is O(n)
So this algorithm is O(n^2)
Also space complexity should be improved by using string builder otherwise a new string is created on every new character.