10 Google Interview Puzzles

Here is a list of 10 puzzles which have been asked on a Google Interview. They are not in any specific order.

Reverse a LinkedList

Reverse a Linked-list. Write code in C. 

Challenge – Equal Probability between 1 and 7

Write a method to generate a random number between 1 and 7, given a method that generates a random number between 1 and 5. 


Sub-Array with the Largest Sum

You are given an array with integers (both positive and negative) in any random order. Find the sub-array with the largest sum. Answer

How Strong is an Egg?

You have two identical eggs. Standing in front of a 100 floor building, you wonder what is the maximum number of floors from which the egg can be dropped without breaking it. What is the minimum number of tries needed to find out the solution? Answer
Continue Reading Below

Four People on a Rickety Bridge

Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge? 

Boys and Girls

In a country where everyone wants a boy, each family continues having babies till they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same) 

Probability of a Car Passing By

The probability of a car passing a certain intersection in a 20 minute windows is 0.9. What is the probability of a car passing the intersection in a 5 minute window? (Assuming a constant probability throughout) 

Pick a Random Byte

You have a stream of bytes from which you can read one byte at a time. You only have enough space to store one byte. After processing those bytes, you have to return a random byte. Note: The probability of picking any one of those bytes should be equal. 

Piece of Cake

How would you cut a rectangular cake into two equal pieces when a rectangular piece has already been cut out of it? The cut piece can be of any size and orientation. You are only allowed to make one straight cut. 

How Old Are My Children?

Two old friends, Jack and Bill, meet after a long time.

Jack: Hey, how are you man?
Bill: Not bad, got married and I have three kids now.
Jack: That’s awesome. How old are they?
Bill: The product of their ages is 72 and the sum of their ages is the same as your birth date.
Jack: Cool… But I still don’t know.
Bill: My eldest kid just started taking piano lessons.
Jack: Oh now I get it.

How old are Bill’s kids? 


Comments