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 overloading and its types?
c++ program to swap the objects of two different classes
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
What is use of overloading?
Why do we use class?
What are the 4 pillars of oop?
What is destructor give example?
What is the difference between a constructor and a destructor?
When not to use object oriented programming?
What is oops with example?
explain sub-type and sub class? atleast u have differ it into 4 points?
What makes a language oop?
What is abstraction with example?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?