Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the point of oop?

1105


Which method cannot be overridden?

1016


How do you achieve polymorphism?

1037


What are the features of oop?

1094


What is polymorphism give a real life example?

972


What is persistence in oop?

1094


What is and I oop mean?

1107


What is destructor oops?

1035


What is abstraction in oop with example?

1061


What is coupling in oops?

1066


What does it mean when someone says I oop?

1016


What is encapsulation in simple terms?

975


Can main method override?

1060


How many human genes are polymorphic?

1001


Is enum a class?

1003