Google Interview Puzzles

The Latest and exclusive collection of Google Interview Puzzles to tease your brain. Google Interview Puzzles helps exercising the brain and develop it to think logical and solve real world problems differenlty. PuzzleFry brings you the best Google Interview Puzzles, you'll enjoy wide range of Google Interview Puzzles, Lets try few Google Interview Puzzles listed below -
  • There are twenty coins sitting on the table, ten are currently heads and tens are currently tails. You are sitting at the table with a blindfold and gloves on. You are able to feel where the coins are, but are unable to see or feel if they heads or tails. You must create two sets of coins. Each set must have the same number of heads and tails as the other group. You can only move or flip the coins, you are unable to determine their current state. How do you create two even groups of coins with the same number of heads and tails in each group?

    View Solution
    Submit Solution
    • 1,440.8K views
    • 1 answers
    • 0 votes

  • One day three Greek philosophers settled under the shade of an olive tree, opened a bottle of Retsina, and began a lengthy discussion of the Fundamental Ontological Question: Why does anything exist?

    After a while, they began to ramble. Then, one by one, they fell asleep.

    While the men slept, three owls, one above each philosopher, completed their digestive process, dropped a present on each philosopher’s forehead, the flew off with a noisy “hoot.”

    Perhaps the hoot awakened the philosophers. As soon as they looked at each other, all three began, simultaneously, to laugh. Then, one of them abruptly stopped laughing. Why?

    View Solution
    Submit Solution
    • 1,439.7K views
    • 1 answers
    • 0 votes

  • We have an egg problem again. There is a 36 story building for which you have complete access. You have two eggs and you must follow the below facts:

    An egg that does not breaks on falling can be re used.

    1) A broken egg will be discarded immediately

    2) All the eggs will experience the same effect of the fall as all the eggs are identical.

    3) Suppose if an egg breaks on falling from first floor, it will definitely break from all the floors above the first floor.

    4) If an egg does not breaks from falling from the thirty sixth floor, it will not break from all the floor below it as well.

    5) All you have to do is find out the minimum drops with which you can determine the floor which is safe to drop eggs from.

    View Solution
    Submit Solution
    • 1,438.5K views
    • 1 answers
    • 0 votes



  • Here is a situation. You have 10 boxes that contains balls with each of the ball weighing 10 grams precisely. Now among the boxes, one of the box comprises of defective balls with each defective ball weighing 9 grams. You have been provided with an electronic weighing machine but you are allowed to use it only once.

    Can you find out which box contains defective balls?

    View Solution
    Submit Solution
    • 1,439.1K views
    • 1 answers
    • 0 votes

  • prisionor-warden-puzzle

    23 selected prisoners are summoned by the warden. He gives them a choice of playing a game with him that might ensure their escape from the prison or might as well lead them towards painful death. The prisoners think that this is the only chance for them to be free again and agrees to him.

    The warden tell them that there is a room which has just two switches which are labelled 1 or 2. The switches may be up or down and the condition is not known at present. They are not connected to anything. The warden may select any prisoner on any day and send him to the switch room. The prisoner will have to select any one switch and reverse its position i.e. if it is up, he will turn it down and if it is down, he will turn it up. He can and must only flip one switch and then he will be confined to his cell again.

    The warden may choose the same prisoner more than one time and he will be choosing completely randomly. But at a certain point of time, everyone will have visited the switch room. And at any time, the prisoners may declare that everyone has visited the room at least once. If they will be true, they will be set free but if they will be wrong, they will be killed.

    The warden gives them an hour to plan any kind of strategy and then they will be confined to their respective cells and will never be allowed to meet. What strategy can help them be free?

    View Solution
    Submit Solution
    • 1,440.3K views
    • 1 answers
    • 1 votes

  • This was the second problem for Google Code Jam Qualification round 2014, if you are able to solve this problem with the first one(which is very easy) you will be eligible for the next round.

    Problem

    In this problem, you start with 0 cookies. You gain cookies at a rate of 2 cookies per second, by clicking on a giant cookie. Any time you have at least C cookies, you can buy a cookie farm. Every time you buy a cookie farm, it costs you C cookies and gives you an extra F cookies per second.

    Once you have X cookies that you haven’t spent on farms, you win! Figure out how long it will take you to win if you use the best possible strategy.

    Example

    Suppose C=500.0, F=4.0 and X=2000.0. Here’s how the best possible strategy plays out:

      1. You start with 0 cookies, but producing 2 cookies per second.

     

      1. After 250 seconds, you will have C=500 cookies and can buy a farm that producesF=4 cookies per second.

     

      1. After buying the farm, you have 0 cookies, and your total cookie production is 6 cookies per second.

     

      1. The next farm will cost 500 cookies, which you can buy after about 83.3333333seconds.

     

      1. After buying your second farm, you have 0 cookies, and your total cookie production is 10 cookies per second.

     

      1. Another farm will cost 500 cookies, which you can buy after 50 seconds.

     

      1. After buying your third farm, you have 0 cookies, and your total cookie production is 14 cookies per second.

     

      1. Another farm would cost 500 cookies, but it actually makes sense not to buy it: instead you can just wait until you have X=2000 cookies, which takes about142.8571429 seconds.

     

    Total time: 250 + 83.3333333 + 50 + 142.8571429 = 526.1904762 seconds.

    Notice that you get cookies continuously: so 0.1 seconds after the game starts you’ll have 0.2 cookies, and π seconds after the game starts you’ll have 2π cookies.

    Input

    The first line of the input gives the number of test cases, TT lines follow. Each line contains three space-separated real-valued numbers: CF and X, whose meanings are described earlier in the problem statement.

    CF and X will each consist of at least 1 digit followed by 1 decimal point followed by from 1 to 5 digits. There will be no leading zeroes.

    Output

    For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1) and y is the minimum number of seconds it takes before you can have X delicious cookies.

    We recommend outputting y to 7 decimal places, but it is not required. y will be considered correct if it is close enough to the correct number: within an absolute or relative error of 10-6. See the FAQ for an explanation of what that means, and what formats of real numbers we accept.

    Limits

    1 ≤ T ≤ 100.

    Small dataset

    1 ≤ C ≤ 500.
    1 ≤ F ≤ 4.
    1 ≤ X ≤ 2000.

    Large dataset

    1 ≤ C ≤ 10000.
    1 ≤ F ≤ 100.
    1 ≤ X ≤ 100000.

    Sample

     

    Input Output
    4
    30.0 1.0 2.0
    30.0 2.0 100.0
    30.50000 3.14159 1999.19990
    500.0 4.0 2000.0

     

    Case #1: 1.0000000
    Case #2: 39.1666667
    Case #3: 63.9680013
    Case #4: 526.1904762

     

     

    View Solution
    Submit Solution
    • 1,438.7K views
    • 1 answers
    • 0 votes

  • Hostile members of the Uti, Grundi and Yomi groups
    were travelling to a conference. There were two members
    from each group, one finned and one feathered.
    The finned Martian was much stronger, and had to
    protect her feathered friend. Never could a feathered
    Martian be left alone with a finned Martian of another
    group. The only time a feathered Martian was safe with
    the finned Martian of another group was when the
    feathered Martian of that enemy group was also
    present.
    The trip was quiet until they came to a deep ravine.
    The only way to cross it was by swinging across on a
    rope. But the rope was only strong enough to hold two
    of them. And it wasn’t heavy enough for them to swing
    it back over the ravine without someone to weigh it
    down. How did they all cross the ravine?

    View Solution
    Submit Solution
    • 1,441.0K views
    • 1 answers
    • 0 votes



  • The owner of a banana plantation has a camel. He wants to transport his 3000 bananas to the market, which is located after the desert. The distance between his banana plantation and the market is about 1000 kilometer. So he decided to take his camel to carry the bananas. The camel can carry at the maximum of 1000 bananas at a time, and it eats one banana for every kilometer it travels.

    What is the most bananas you can bring over to your destination?

    View Solution
    Submit Solution
    • 1,450.3K views
    • 1 answers
    • 0 votes

  • You have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). the second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), ec, until you only visit the 100th door.

    What state are the doors in after the last pass? Which are open which are closed?
    Puzzle asked in: Google,Adobe,Amazon,Oracle

    100 door puzzle

    View Solution
    Submit Solution
    • 1,450.8K views
    • 2 answers
    • 0 votes

  • There is a building of 100 floors
    -If an egg drops from the Nth floor or above it will break.
    -If it’s dropped from any floor below, it will not break.
    You’re given 2 eggs.
    Find N

    How many drops you need to make?
    What strategy should you adopt to minimize the number egg drops it takes to find the solution?

    2 eggs 100 floor puzzle

    View Solution
    Submit Solution
    • 1,610.0K views
    • 15 answers
    • 2 votes