Asadullah Ansari

Build-Up Your Problem Solving Skill : Specially Using By C/C++/Data Structure Puzzles/New Technique Algorithm Design/ Understanding New Technology

Freeze your mind!!!!

Posted by asadullahansari on August 22, 2008

A bank has a collection of n bank cards that they�€™ve confiscated, suspecting them of being used in a fraud. Each bank card corresponds to a unique account in the bank. Each account can have many cards corresponding to it, and we�€™ll say that two bank cards are equivalent if they correspond to the same account. The only way to say 2 cards are equivalent is by using a high-tech �€œequivalence-tester�€� that takes in 2 cards, and after performing some computations, determines whether they are equivalent.

Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester.
Solve it in O(n) complexity.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: