Given two strings like x=?hello? and y=?open?, remove any
character from string x which is also used in string y,
thus making the result x=?hll?.
Answer Posted / vijay bhatia
string processString(string x, string y) {
string res = "";
int occuranceCount[26];
for(int i=0; i<26; i++) {
occuranceCount[i] = 0;
}
for(i=0; i<y.size(); i++) {
occuranceCount[y[i]-'a']++;
}
for(i=0; i<x.size(); i++) {
if (occuranceCount[x[i]-'a'] == 0) {
res += x[i];
}
}
return res;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the point of oop?
Which method cannot be overridden?
How do you achieve polymorphism?
What are the features of oop?
What is polymorphism give a real life example?
What is persistence in oop?
What is and I oop mean?
What is destructor oops?
What is abstraction in oop with example?
What is coupling in oops?
What does it mean when someone says I oop?
What is encapsulation in simple terms?
Can main method override?
How many human genes are polymorphic?
Is enum a class?