is there a property in String class in c++ which follows my requirement :
print the string ( with just one character removed--- The character can be specified randomly)
COMPUTER wiith 1 should give OMPUTER
No plz dont say that use in the for loop ;) some other approach
Ue the substr() member function. You would need to call it twice if the character to be ignored is in the middle of the string.
s...slice was another option i thought of.
but... is the complexity better than O(n) ?????i mean to ask better than using for loop...
I need an optimised one
I do not think that std::string has a slice member function. If you actually want to modify the string, you could just erase the character.
No, the complexity cannot be better than O(n) in general, where n is the number of characters. It will not matter anyway, since printing must take O(n) time.