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 / skybeaver
static public string StupidQuestion(string x, string y)
{
StringBuilder sb = new StringBuilder();
Hashtable ht = new Hashtable();
// just one pass through y
foreach( char c in y.ToCharArray() )
if( !ht.Contains(c) )
ht.Add(c, c)
// just one pass thru x
foreach( char c in x.ToCharArray() )
if( !ht.Contains(c) )
sb.Append(c);
return sb.ToString();
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
hi all..i want to know oops concepts clearly can any1 explain??
c++ program to swap the objects of two different classes
What are properties in oop?
write knight tour problem which is present in datastructure
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.
write a C++ program for booking using constructor and destructor.
What polymorphism means?
What does sksksk mean in text slang?
What is polymorphism in oop example?
class type to basic type conversion
What are the advantages of polymorphism?
What is the point of oop?
What is advantage of inheritance?
What is inheritance and how many types of inheritance?
Why oops is important?