Asadullah Ansari

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

Posts Tagged ‘puzzle’

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.

Posted in Queries & Answers | Tagged: , | Leave a Comment »

solve this puzzle?

Posted by asadullahansari on August 20, 2008

Two boys walking in the woods decide to take a shortcut thru a railroad tunel. When they had walked 2/3 of the way, their worst fears were realized. A train was coming in the opposite direction, nearing the tunnel entrance. They boys panicked and each ran for a different end of the tunnel. Both boys ran at the same speed, 10 miles per hour Each boy escaped from the tunnel just at the instant the train would have squashed him. Assuming the train’s speed was constant, and both boys were capable of instantaneous reaction and acceleration, how fast was the train going?

Posted in Queries & Answers | Tagged: | 4 Comments »