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 11, 2014

3D Tic Tac Toe Puzzle

Source: Shared by Alok Mittal (Cannan Partners)

A 3x3 tic tac toe has 8 "winning lines" (3 horizontal, 3 vertical and 2 diagonals). How many "winning lines" does the 3x3x3 3D tictactoe have? There is a brute force solution, and then there is the aha! solution.

Jul 3, 2014

Mad Robot Puzzle

Source: http://nrich.maths.org/


A mad robot sets off towards the North East on a journey from the point (0,0) in a coordinate system. It travels in stages by moving forward and then rotating on the spot. It follows these pseudo-code instructions:

    DISTANCE = 1000
    WHILE (DISTANCE > 0.001)

Where does the robot explode?

Jul 1, 2014

Social Network Friendship Paradox

Problem / Observation:

The friendship paradox is the phenomenon first observed by the sociologist Scott L. Feld in 1991 that most people have fewer friends than their friends have, on average. Prove it mathematically.

Jun 17, 2014

Expected length of Last Straw - Breaking the back of a camel

Source: Puzzle Tweeter who took it from Mind your decisions

Problem: A camel is loaded with straws until it's back breaks. Each straw has a weight uniformly distributed between 0 and 1, independent of other straws. The camel's back breaks as soon as the total weight of all the straws exceeds 1. Find the expected weight of the last straw that breaks the camel's back.

Update (18th June 2014):
Solution posted by me (Pratik Poddar) in comments

Jun 16, 2014

Cards on a Square Turntable

Source: Steve Miller's Math Riddles


A square has a quarter in each corner. You are blindfolded and must get all quarters to be heads up or all to be tails up. You will be told when you have done this. You may flip however many you want, then ask if you are done (this constitutes a turn). The square is then rotated/spun an undisclosed number of times. You then get another turn and so on…

Is there a strategy that is guaranteed to work in a finite number of moves, and if so, what is that smallest number of moves you need to be 100% you’ll be able to have all heads up or all tails up?

The same problem is there on the blog - in a different form - asked more than 50 months back :-) - Blind Flipping - CSE Blog