Remove character
aabccbaa
a
bccb
public class Solution {
public static String removeAllOccurrencesOfChar(String str, char ch) {
int l=str.length();
String s="";
for(int i=0;i<l;i++)
{
char c = str.charAt(i);
if(ch!=c)
{
s=s+c;
}
}
return s;
}
}
Comments
Post a Comment