Monday, 12 November 2012

Solution of 100 door puzzle....microsoft interview puzzle

1 comments

Solution:

This problem is designed to seem overwhelming. You don’t have time to draw a diagram of 100 lockers and count 100 passes through them. Even if you did, solving the problem that way wouldn’t illustrate any skill or intuition, so there must be some trick that can be used to determine how many doors will be open. You just have to figure out what that trick is.
It’s unlikely that you’re going to be able to intuit the solution to this problem by just staring at it. What can you do? Although it’s not practical to solve the entire problem by brute force, solving a few lockers in this manner is reasonable. Perhaps you’ll notice some patterns you can apply to the larger problem.
Start by choosing an arbitrary locker, 12, and determining whether it will end open or closed. On which passes will you toggle locker 12? Obviously on the first pass, when you toggle every locker, and on the twelfth pass when you start with 12. You don’t need to consider any pass after 12 because those will all start farther down the hall. This leaves passes 2 through 11. You can count these out: 2, 4, 6, 8, 10, 12 (you toggle on pass 2); 3, 6, 9, 12 (on 3); 4, 8, 12 (on 4); 5, 10, 15 (not on 5); 6, 12 (on 6); 7, 14 (not on 7), and so on. Somewhere in the middle of this process, you will probably notice that you toggle locker 12 only when the number of the pass you’re on is a factor of 12. If you think about this, it makes sense: When counting by n, you hit 12 only when some integer number of n’s add to 12, which is another way of saying that n is a factor of 12. Though it seems simple in retrospect, this probably wasn’t obvious before you worked out an example.

Solution of 2 Egg Problem: Google Interview Puzzle

0 comments

Solution:

Drop the first egg from 50.If it breaks you can try the same approach for a 50-storey building (1 to 49) and try it from 25th floor. If it did not break try at 75th floor. And use linear search with the remaining portion of storey we need to test. For example if the first egg breaks at 50 we need to try all possibilities from 1 to 49.

Now this looks a feasible solution. In computer student's jargon do a binary search with first egg and linear search with the second one. Best case is log (100) and worst is 50.

Red Marbles and Blue Marbles puzzle...goggle puzzle

0 comments

Problem:
you have two jars, 50 red marbles, 50 blue marbles. you need to place all the marbles into the jars such that when you blindly pick one marble out of one jar, you maximize the chances that it will be red. (when picking, you’ll first randomly pick a jar, and then randomly pick a marble out of that jar) you can arrange the marbles however you like, but each marble must be in a jar.

100 Doors in a Row...microsoft puzzle

0 comments

Question:
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), etc, until you only visit the 100th door.
question: what state are the doors in after the last pass? which are open which are closed?

Solution:

For example, after the first pass every door is open. on the second pass you only visit the even doors (2,4,6,8…) so now the even doors are closed and the odd ones are opened. the third time through you will close door 3 (opened from the first pass), open door 6 (closed from the second pass), etc..

13 Balls problem : One of Hardest Interview Questions

0 comments
One of the most classic puzzles involving balls is figuring out the odd one out using common balance.There are many levels of puzzles based on the same concept for different levels of interviews - Simple ones for phone interviews to the most gruelling 1 hour hard work needing hard ones.

Problem space
The general problem is you will be given n balls and one of them is either heavier or lighter and you are asked to find out the minimum number of weighings using a common balance required to find out the odd one out.

Example 1:8 Balls,Odd ball being heavier
This is the simplest question among the lot and is often used during phone screenings.The question is to find out the minimum number of weighings required to spot the odd heavier ball among 8 identically looking balls using a common balance.Answer is 2 and the solution is given in the next paragraph.

3 Classic Weighing puzzles :Simple Medium and Hard (Google puzzle)

0 comments

In this post I want to describe about a series of puzzles called weighing puzzles. These puzzle vary in hardness from simple to extremely mathematical involving either expertise in some fields or extreme ingenuity. Either you know it or you figure out it using extreme intelligence. So here is the chance for some people to burn your grey cells.

I am putting forward three puzzles with varying range of hardness. Sometimes you may feel the hardest one is very easy for you have already come across the theory, but I still made it the hardest for the people who will be solving it with out knowing the theory behind it, giving them an option to figure out a small part in evolution of computational history.
There is a shopkeeper who wants to weigh things who has a common balance. He must be in a position to weigh things of all possible integral weighing units from 1 to a given maximum sum. The question will be either about how many weights you will need or how will you weigh.


2 Egg Problem: Google Interview Puzzle

1 comments


My intention here is not to trouble Google interviewers. I was just collecting some classic puzzles and found this one and a small Google search showed me that this is a Google interview puzzle to my pleasant surprise. But many of the answers I found were either wrong or totally twisted. I am making no surety of the answer I give and I am open to your remarks or suggestion or corrections.


Question:
The Standard Problem in simple writing goes like this:
* You are given 2 eggs.
* You have access to a 100-storey building.
* Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical.
* You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking.
* Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process

Wednesday, 17 October 2012

Three Ants on Triangle Riddle

0 comments

Now many companies ask this puzzle while recruiting the students. This puzzle is asked during interview by Microsoft while electing the people for their company.  This puzzle somewhat mathematical oriented. This interview puzzle is famously known as “Three Ants on Triangle” puzzle. People who know the concepts of probability can easily solve this puzzle.

Puzzle:
Three ants are sitting at the three corners of an equilateral triangle. Each ant starts randomly picks a direction and starts to move along the edge of the triangle. What is the probability that none of the ants collide?

Sunday, 14 October 2012

100 locker riddle

0 comments

Puzzle:

There are 100 closed lockers in a hallway. A man begins by opening all the 100
lockers. Next, he closes every second locker. Then he goes to every third locker
and closes it if it is open or opens it if it is closed (eg, he toggles every third
locker). After his 100th pass in the hallway, in which he toggles only locker
number 100, how many lockers are open?

Thursday, 11 October 2012

Solution: People`s hat puzzle on Island..(awesome logic)

0 comments

Solution:

This problem seems hard, so let’s simplify it by looking at specific cases.
Case c = 1: Exactly one man is wearing a hat.
Assuming all the men are intelligent, the man with the hat should look around and realize
that no one else is wearing a hat. Since the genie said that at least one person is wearing a
hat, he must conclude that he is wearing a hat. Therefore, he would be able to remove it that
night.

Case c = 2: Exactly two men are wearing hat.
The two men with hat see one crown, and are unsure where c = 1 or c = 2. They know, from
the previous case, that if c = 1, the crowns would be removed on Night #1. Therefore, if the
other man still has a hat, he must deduce that c = 2, which means that he has a hat. Both men
would then remove the crown on Night #2

People`s hat puzzle on Island..(awesome logic)

0 comments

Puzzle:

A bunch of men are on an island. A genie comes down and gathers everyone
together and places a magical hat on some people’s heads (e.g., at least one).
The hat is magical: it can be seen by other people, but not by the wearer of the
hat himself. To remove the hat, you must dunk yourself underwater at exactly
midnight. If there are n people and c hats, how long does it take the men remove
the crowns? The men cannot tell each other (in any way) that they have
a hat.

Tuesday, 9 October 2012

2 eggs dropped from 100th floor with Best solution

0 comments

Problem Statement:

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, while minimizing the number of drops for the worse case.
Solution:
Observation: Regardless of how we drop Egg1, Egg2 must do a linear search. Eg, if the Egg1
breaks between floor 10 and 15, we have to check every floor in between with the Egg2
The Approach:
A First Try: Suppose we drop an egg from the 10th floor, then the 20th, …
»» In the first egg breaks on the first drop (Floor 10), then we have at most 10 drops total.
»» If the first egg breaks on the last drop (Floor 100), then we have at most 19 drops total
(floors 1 through 100, then 91 through 99).

arithmetic operators puzzle 3 1 3 6 =8

0 comments

Puzzle:

Add arithmetic operators (plus, minus, times, divide) to make the following expression true: 3 1 3 6 = 8. You can use any parentheses you’d like.
Solution:

An interviewer is asking this problem to see how you think and approach problems—so
don’t just guess randomly.
Try approaching this the following way: What sorts of operations would get us to 8? 
I can think of a few:
4 * 2 = 8
16 / 2 = 8
4 + 4 = 8

Monday, 8 October 2012

Google Interview Preparation Tips

4 comments


There are many scary stories floating around about Google interviews, but it’s mostly just that stories. The interview is not terribly different from Microsoft’s or Amazon’s.
However,because Google HR can be a little disorganized, we recommend being proactive in communication.

>Google engineer performs the first phone screen, so expect tough technical questions. On your onsite interview, you’ll interview with four to six people, one of whom will be a lunch interviewer. Interviewer feedback is kept confidential from the other interviewers, so you can be assured that you enter each interview with blank slate. Your lunch interviewer doesn’t submit feedback, so this is a great opportunity to ask honest questions.

Sunday, 30 September 2012

Aeroplane..(Microsoft puzzle)

0 comments


Riddle:
The puzzle question is : On Bagshot Island, there is an airport. The airport is the homebase of an unlimited number of identical airplanes. Each airplane has a fuel capacity to allow it to fly exactly 1/2 way around the world, along a great circle. The planes have the ability to refuel in flight without loss of speed or spillage of fuel. Though the fuel is unlimited, the island is the only source of fuel.


What is the fewest number of aircraft necessary to get one plane all the way around the world assuming that all of the aircraft must return safely to the airport? How did you get to your answer?
Notes:
(a) Each airplane must depart and return to the same airport, and that is the only airport they can land and refuel on ground.
(b) Each airplane must have enough fuel to return to airport.
(c) The time and fuel consumption of refueling can be ignored. (so we can also assume that one airplane can refuel more than one airplanes in air at the same time.)
(d) The amount of fuel airplanes carrying can be zero as long as the other airplane is refueling these airplanes. What is the fewest number of airplanes and number of tanks of fuel needed to accomplish this work? (we only need airplane to go around the world)


Wednesday, 19 September 2012

Recent comments

Send Quick Massage

Name

Email *

Message *

Recent posts

Total Pageviews

Blog Archive