There are three ants on a triangle, one at each corner. at a given moment in time, they all set off for a different corner at random. what is the probability that they don’t collide? Solution Consider the triangle ABC. We assume that the ants move towards different corners along the edges of the triangle.
How many places are there on the earth that one could walk one mile south, then one mile east, then one mile north and end up in the same spot? to be precise, let’s assume the earth is a solid smooth sphere, so oceans and mountains and other such things do not exist. you can… Read More »
This is difficult to describe in words, so read this carefully, lest there be any confusion. You have a normal six sided cube. i give you six different colors that you can paint each side of the cube with (one color to each side). How many different cubes can you make?
I buried four fishermen up to their necks in the sand on the beach at low tide for keeping their fishing spot a secret from me. I put a hat on each of their heads and told them that one of them must shout out the correct color of their own hat or they will… Read More »
You die and the devil says he’ll let you go to heaven if you beat him in a game. the devil sits you down at a round table. he gives himself and you a huge pile of quarters. He says “ok, we’ll take turns putting quarters down, no overlapping allowed, and the quarters must rest… Read More »
There is a pot of N noodles. (so there are 2N ends). A person randomly grabs two ends and merges them. The person keeps doing it, until there are no more noodles, (and only loops), left in the pot. what’s the average number of loops in the pot?
A person dies, and arrives at the gate to heaven. there are three doors. one of them leads to heaven. another one leads to a 1-day stay at hell, and then back to the gate, and the other leads to a 2-day stay at hell, and then back to the gate. every time the person… Read More »
Someone walks into your room and dumps a huge bag of quarters all over the floor. They spread them out so no quarters are on top of any other quarters. a robot then comes into the room and is programmed such that if it sees a head, it flips it to tails. If it sees… Read More »
I challenge you to a game. we each get one penny and we flip them at the same time. (so on turn 1, we each flip our respective pennies – turn 2, we flip them again, and so on until someone wins). I am looking to get heads then tails. You are looking to get… Read More »
How does one find a loop in a singly linked list in O(n) time using constant memory? You cannot modify the list in any way (and constant memory means the amount of memory required for the solution cannot be a function of n.).