CSE Blog - quant, math, computer science puzzles

Quant, Math & Computer Science Puzzles for Interview Preparation & Brain Teasing
A collection of ~225 Puzzles with Solutions (classified by difficulty and topic)

Jul 27, 2016

Law of Large Numbers Failed


Problem:
There are two maternity hospitals in a town with 50 and 500 beds. Given full occupancy on a particular day, which of these hospitals is more likely to have equal no of boys and girls given probability of boys = probability of girls ?

What would the answer intuitively be by #‎LawOfLargeNumbers‬? You would see #LawOfLargeNumbers does not seem to work here. How should the statement be positioned for #LawOfLargeNumbers to work? 

Jun 30, 2016

Gold Links Puzzle


Source: Alok Goyal (Stellaris VP) puzzle blog

Problem:

This is another famous puzzle in the Martin Gardner collection, and variations of this puzzle exist in different “sizes”. This particular one has been picked up from The Colossal Book of Short Puzzles and Problems, Puzzle 9.18. Replicating the puzzle as is.

Lenox R. Lohr, president of the Museum of Science and Industry in Chicago, was kind enough to pass along the following deceptively simple version of a type of combinatorial problem that turns up in many fields of applied mathematics. A traveler finds himself in a strange town without funds; he expects a large check to arrive in a few weeks. His most valuable posession is a gold watch chain of 23 links. To pay for a room he arranges with a landlady to give her as collateral one link a day for 23 days. Naturally, the traveler wants to damage his watch chain as little as possible. Instead of giving the landlady a separate link each day he can give her one link the first day, then on the second day take back the link and give her a chain of two links. On the third day he can give her the single link again and on the fourth take back all she has and give her a chain of four links. All that matters is that each day she must be in possession of a number of links that corresponds to the number of days.
The traveler soon realizes that this can be accomplished by cutting the chain in many different ways. The problem is: What is the smallest number of links the traveler needs to cut to carry out his agreement for the full 23 days?

Gold Links Puzzle


Source: Alok Goyal (Stellaris VP) puzzle blog

Problem:

This is another famous puzzle in the Martin Gardner collection, and variations of this puzzle exist in different “sizes”. This particular one has been picked up from The Colossal Book of Short Puzzles and Problems, Puzzle 9.18. Replicating the puzzle as is.

Lenox R. Lohr, president of the Museum of Science and Industry in Chicago, was kind enough to pass along the following deceptively simple version of a type of combinatorial problem that turns up in many fields of applied mathematics. A traveler finds himself in a strange town without funds; he expects a large check to arrive in a few weeks. His most valuable posession is a gold watch chain of 23 links. To pay for a room he arranges with a landlady to give her as collateral one link a day for 23 days. Naturally, the traveler wants to damage his watch chain as little as possible. Instead of giving the landlady a separate link each day he can give her one link the first day, then on the second day take back the link and give her a chain of two links. On the third day he can give her the single link again and on the fourth take back all she has and give her a chain of four links. All that matters is that each day she must be in possession of a number of links that corresponds to the number of days.
The traveler soon realizes that this can be accomplished by cutting the chain in many different ways. The problem is: What is the smallest number of links the traveler needs to cut to carry out his agreement for the full 23 days?

Sep 13, 2015

Soldiers in a Line

Source: Alok Goyal's Puzzle Page

Problem:
In a line up of 10 soldiers, what is the least number of soldiers that can be picked in order of either ascending or descending heights? Assume that no two soldiers have the same height. Soldiers can be picked from anywhere in the line, but their order of standing cannot be changed.


Apr 15, 2015

(Advanced) Cheryl's Birthday Puzzle

Source: Sent to me by Prateek Chandra Jha (IIT Bombay)

Problem:
This problem is inspired by the Cheryl's Birthday Puzzle (FB Post, Guardian Link).

Paul, Sam and Dean are assigned the task of figuring out two numbers. They get the following information:

Both numbers are integers between (including) 1 and 1000

Both numbers may also be identical.

Paul is told the product of the two numbers, Sam the sum and Dean the difference. After receiving their number, the following conversation takes place:
Paul: I do not know the two numbers.
Sam: You did not have to tell me that, I already knew that.
Paul: Then I now know the two numbers.
Sam: I also know them.
Dean: I do not know the two numbers. I can only guess one which may probably be correct but I am not sure.
Paul: I know which one you are assuming but it is incorrect.
Dean: Ok, I also know the two numbers.

What are the two numbers?

Disclaimer:
Its not a puzzle for 14-15 year olds like Cheryl's