Monday, 12 November 2012

count the number of students in a classroom in quickest way

0 comments

Question:

How will you count the number of students in a classroom in quickest possible manner.

Solution:
Ask the class to stand up and make pairs, if one student is left out write '1' else write 0. tell the left out student to sit down and ask one person in each group to sit down. Repeat the process and append '1' or '0' to your number, until no student is left standing. You will get the binary representation of the number of students in reverse order.

100 Doors Puzzle Or Door Toggling Puzzle

0 comments

Question:
This is a very common interview puzzle. The problem is very simple if you understand it. So the point to note is, do not arrive at the solution so "fast”, if you are asked this puzzle in an interview and if you are not planning to show any acquaintance with this puzzle.

Problem goes like this :
There are N doors in a row numbered from 1 to N. Initially all are closed.
Then you make N passes by the N doors. In pass 1 you toggle the all the doors (1,2,3,4....)starting from the first door. In the second pass you toggle every second door(2,4,6,8,...). In the third pass you toggle all third doors(3,6,9...).Similarly you make N passes.

Wednesday, 24 October 2012

Tansporting 3000 banana riddle.(microsoft puzzle)

0 comments

Puzzle
A banana plantation is located next to a desert. The plantation owner has 3000 bananas that he wants to transport to the market by camel, across a 1000 kilometer stretch of desert. The owner has only one camel, which carries a maximum of 1000 bananas at any moment in time, and eats one banana every kilometre it travels. What is the largest number of bananas that can be delivered at the market?

4 bucket puzzle....(amazon riddle)

0 comments

Puzzle:
A company produces play ball of weights 0-25kg, 25-50kg, 50-75kg, 75-100kg. You need to put the balls in four different buckets daily depending on the number of ball company produces.BucketA (0-25kg), BucketB (25-50kg), BucketC (50-75kg) and BucketD(75-100kg).
A scale is provided on which you can weigh only 1 ball at a time which has a bulb. If the weight of the ball matches the scale category, the bulb will light up otherwise it will be OFF.

e.g. If scale is marked to measure 10-25 kg, then any ball between 10 to 25kg (inclusive 10 and 25) will switch on the bulb and say if you weigh 26 it wont switch on the bulb. The cost of scale is 1 million dollar.
Question: You need to find the minimum number you will use to do the job.Also what is weight category you will choose for the scales to do the job.


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

Sunday, 7 October 2012

Amazon Interview Preparation Tips

0 comments


Amazon’s recruiting process usually begins with one or two phone screens in which you interview with a specific team. The ENGINEER who interviews you will usually ask you to write simple code and read it aloud on the phone. They will ask a broad set of questions to explore what areas of technology you’re familiar with.

ĂĽ  Next, you fly to Seattle for four or five interviews with one or two teams which have selected you based on your resume and phone interviews. You will have to code on a whiteboard, and some interviewers will stress other skills. Interviewers are each assigned a specific area to probe and may seem very different from each other. They can not see other feedback until they have submitted their own and they are discouraged from discussing it until the hiring meeting.

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

Saturday, 15 September 2012

Solution: Maximum no. of matches puzzle

0 comments

Solution:
56 points are distributed to 8 team. In the worst case, team0 loses all the games, he gets 0 point. team1 win two games with team0 and loses all other games, he gets 2 points.
In the same way, team2 gets 4 points, team3 gets 6 points. So there are 44 points left which can be distributed to the remaining 4 teams. So the assurance points for a team should be 11 points.


Recent comments

Send Quick Massage

Name

Email *

Message *

Recent posts

Total Pageviews

Blog Archive