7 is a prime number and 7+1=8 is a perfect cube. Can you find another prime number p such that p+1 is a perfect cube?
- via Daily Brain Teaser
Suppose you have an array of size n, where each element in the array is either 0, 1 or 2. How will you compute the minimum number of swaps required to sort the array in O(n) time?
- via Algorithmic Fest at Stanford
You are given an array of n distinct integers. A swap is interchanging the value of two positions in the array. What is the minimum number of swaps required to sort the array?
For example: If the array is [2,1,3], we need only 1 swap (swap 1 and 2). If the array is [2,3,1], we need 2 swaps (swap 2 and 3, then swap 1 and 3).
- via Stack Overflow
Can you move two sticks so that the fly is outside the glass?
-via Best Brain Teasers
There are n people standing in a circle. Staring with person 2, every second person is eliminated until only 1 person survives. Who is the survivor?
Example: If n=7, people are killed in the order 2,4,6,1,5,3 and person 7 survives. If n=5, persons are killed in the order 2,4,1,5 and person 3 survives.
- via Wikipedia
Show that every convex polygon of area 1 is contained in some rectangle of area 2.
- via AMS puzzle corner
A 9x9 grid is filled with numbers from 1 to 81, each number occurring exactly once. The grid is said to be ultramagic if the product of numbers in row k is equal to the product of numbers in column k for each k. Can you construct an ultramagic grid?
- via AMS puzzle corner
Joe owes $100 to creditor A, $200 to creditor B and $300 to creditor C. Joe dies, leaving behind an estate. Unfortunately, Joe's estate has insufficient funds to repay his creditors (yes, that's a very small estate). The question is how does one split the estate among the contestants. Here are three situations and the action by a certain judge in each situation:
1. If the estate is worth $100, split equally giving $33 1/3 to each creditor.
2. If the estate is worth $200, give $50 to A and $75 each to B and C.
3. If the estate is worth $300, give $50 to A, $100 to B and $150 to C (proportional split).
Can you find a logic that justifies this splitting?
You have a jar with 20 black balls and 16 white balls. At each step,
1. You remove two balls.
2. If the two balls are of the same color, you add a black ball. Otherwise you add a white ball.
You repeat these steps until there is only 1 ball remaining in the jar. What is the color of the remaining ball?
As a follow-up question, suppose you start with 100 black balls and 93 white balls. What is the color of the remaining ball?
- via Algorithmic puzzles