Solution:
void remove(char *str )
{
bool hash[256] = {0} ;
for(int i =0, j=0 ; str[i] != '\0'; ++i)
hash[str[i]] || (hash[str[i]] = true, str[j++] = str[i]);
str[j] = '\0';
}
void remove(char *str )
{
bool hash[256] = {0} ;
for(int i =0, j=0 ; str[i] != '\0'; ++i)
hash[str[i]] || (hash[str[i]] = true, str[j++] = str[i]);
str[j] = '\0';
}
No comments:
Post a Comment