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

Nov 21, 2011

Numbers on a circle - Minimum sum of consecutive differences

Source: Asked to me by Anuj Jain (MFE Grad Student at Baruch College in New York, EE IITB 2010 Alumnus)

Problem:
Place the numbers 1, 2, ... 9 around a circle in the positions x_1, x_2, ..., x_9 so that the sum of difference between consecutive terms defined by
Sum over | x_{ i+1 } - x_{ i } | for i = 1, 2, ..., 9 is minimized (Note: x_10 is x_1).

Also count the number of such arrangements where the "sum of difference between consecutive terms" is minimum.

Update (December 13, 2011):
Solution: Partial Solution posted by Chiraag Juvekar (IITB EE Fifth year undergraduate, To be McKinsey Business Analyst) in comments! Complete solution posted by Rudradev Basak (IITD CSE Senior Undergraduate) and Gaurav Sinha (chera, IITK 1996 Graduate, Indian Revenue Service) in comments!

Update (June 22, 2014):
Very generic solution posted by Aashay Harlalka (IITB EE 2014, Two Roads Quantitative Analyst) in comments!

Nov 5, 2011

Guess 3 numbers


Source: Quantnet Forums

Problem:
A question which is asked on interview in some software development companies.
I guessed 3 natural numbers - x,y,z. You can ask me about two sums of these numbers with any coefficients - a,b,c. For example, you give me a, b and c and I tell you the result of the expression a*x+b*y+c*z. Give me the algorithm to find x,y and z.

Observation/Hint:
Irrespective of whether you get the solution, its interesting that you are solving a system of three variables using two equations. You are able to do that because the coefficient in the second equation depends on the answer of the first equation. :)

Update (November 6, 2011):
Solution: Posted by Harsh Pareek (Graduate Student at UT Austin, CSE IITB 2011 Alumnus), Rudradev Basak (IITD CSE Senior Undergraduate) and AnonymousD in comments!

Nov 3, 2011

Scaling a Square

Source: Saurabh Joshi, IIT Kanpur

Problem: On a table you have a square made of 4 coins at the corner at distance 1. So, the square is of size 1×1. In a valid move, you can choose any two coin let’s call them mirror and jumper. Now, you move the jumper in a new position which is its mirror image with respect to mirror. That is, imagine that mirror is a centre of a circle and the jumper is on the periphery. You move the jumper to a diagonally opposite point on that circle. With any number of valid moves, can you form a square of size 2×2? If yes, how? If no, why not?

Update (November 4, 2011)
Solution: Posted by Siddhant Agarwal (EE IITB Alumnus, CMI Grad student) and Rudradev Basak (IITD CSE Senior Undergraduate) in comments!


Nov 1, 2011

Divisibility of 111...1111


Source: Asked to Russian 7th Graders - Taken from Wild For Math Blog

Problem:
Is it true that among the numbers consisting of only "1"s (1; 11; 111; 1111; etc.) there is a number (maybe many) that is divisible by 572,003?

Here 572,003 is taken arbitrarily. Is it true for all numbers?

Update (November 02, 2011):
Solution posted in comments by NG a.k.a Nikhil Garg (IITD CSE Senior Undergraduate), Rudradev Basak (IITD CSE Senior Undergraduate, IMO Bronze Medalist), Yashoteja Prabhu (RA at Microsoft Research, IITB CSE 2011 Alumnus), Siva, Garvit Juniwal (IITB CSE Senior Undergraduate)! Thanks