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
Which language is pure oop?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
What are the benefits of interface?
What is the difference between encapsulation and polymorphism?
What do you mean by Encapsulation?
Prepare me a program for the animation of train
Can static class have constructor?
Who invented oop?
2. Give the different notations for the class.\
when to use 'mutable' keyword and when to use 'const cast' in c++
How do you define social class?
What is pointer in oop?
What is constructor in oop?
What is abstract class in oops?
What is and I oop mean?