Log Date

Welcome to techInterview, a site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!

1. Text post

### Flipping Coins

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 a tail, it throws it in the air. the robot moves around randomly forever. Will there be a convergence in distribution of heads vs. tails?

2. Text post

### Pennies

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 heads then heads. So if you flip heads on any flip and then heads on the next flip, you win. If I flip heads on any flip and then tails on the next flip, I win. (its not a speed race, we both flip at the same time, except i’m only concerned with what appears on my coin, and you are only concerned with whats on your coin). Are the odds fair? (obviously not, otherwise this wouldn’t be a question). who has the advantage and why?

3. Text post

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.).

4. Text post

### Last Ball

You have 20 blue balls and 14 red balls in a bag. you put your hand in and remove 2 at a time. If they’re of the same color, you add a blue ball to the bag. If they’re of different colors, you add a red ball to the bag. (assume you have a big supply of blue & red balls for this purpose. note: when you take the two balls out, you don’t put them back in, so the number of balls in the bag keeps decreasing). What will be the color of the last ball left in the bag?

Once you tackle that, what if there are 20 blue balls and 13 red balls to start with?

5. Text post

### Coin Rolls

Every night, I dump all the change in my pocket into a big bucket.

When I buy things, I never hand over coins. always bills. So I accumulate a lot of coins. Even if the purchase price is \$1.01, and I have lots of coins in my pocket, I pay \$2 and take the 99 cents in change. All the more coins to dump in my change bucket!

After about 10 years of this, I decide to roll all the coins into rolls. Remember that a quarter roll is \$10, a dime roll is \$5, nickels \$2, pennies 50 cents. So I go to the Banking Supply Store and buy empty paper rolls.

The Banking supply store, conveniently, sells assortment packs of coin rolls. Each assortment pack contains W quarter rolls, X dime rolls, Y nickel rolls, and Z penny rolls.

The question: what is the optimum ratio of W to X to Y to Z to maximize the probability that I will use up the assortment packs at the same rate, e.g. without lots of leftover nickel tubes and stuff?

P.S. this problem should ideally be solved using Excel (but if you really like doing these things by hand, be my guest).

submitted by joel

paul brinkley makes these assumptions which are all good assumptions to make:
Assumption 1: The price of purchases made, modulo \$1, is an even distribution from 0 cents to 99 cents.
Assumption 2: The cashier will always give you the least number of coins mathematically possible, and will always have enough of each type of coin to do this. So you’ll never get 99 pennies as change for a \$1.01 purchase, for example.
Assumption 3: Half dollars don’t exist.

Notes: 2 notes

6. Text post

### Calendar Cubes

A man has two cubes on his desk. every day he arranges both cubes so that the front faces show the current day of the month. what numbers are on the faces of the cubes to allow this?

Notes: 2 notes

7. Text post

### Boys and Girls

In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?

Notes: 2 notes

8. Text post

### Painfully Easy

I flip a penny and a dime and hide the result from you. “one of the coins came up heads”, i announce. what is the chance that the other coin also came up heads?

9. Text post

### Nuggets

You can go to a fast food restaurant to buy chicken nuggets in 6-pack, 9-pack or 20-packs. is there such a number N, such that for all numbers bigger than or equal to N, you can buy that number of chicken nuggets?

10. Text post

### Orbs

You have two identical crystal orbs. you need to figure out how high an orb can fall from a 100 story building before it breaks. you know nothing about the toughness of the orbs: they may be very fragile and break when dropped from the first floor, or they may be so tough that dropping them from the 100th floor doesn’t even harm them.

What is the largest number of orb-drops you would ever have to do in order to find the right floor? (i.e. what’s the most efficient way you could drop the orbs to find your answer?)

You are allowed to break both orbs, provided that in doing so you uniquely identify the correct floor.