Interview and programming Puzzles
 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9

Three friends divided some bullets equally. After all of them shot 4 bullets the total number of bullets remaining is equal to the bullets each had after division. Find the original number divided.
18
Explanation:
Assume that initial there were 3*X bullets.
So they got X bullets each after division.
All of them shot 4 bullets. So now they have (X - 4) bullets each.
But it is given that,after they shot 4 bullets each, total number of bullets remaining is equal to the bullets each had after division i.e. X

Therefore, the equation is
3 * (X - 4) = X
3 * X - 12 = X
2 * X = 12
X = 6
Therefore the total bullets before division is = 3 * X = 18

Find sum of digits of D.
Let
A= 19991999
B = sum of digits of A
C = sum of digits of B
D = sum of digits of C

(HINT : A = B = C = D (mod 9))

The sum of the digits od D is 1.

Let E = sum of digits of D.
It follows from the hint that A = E (mod 9)
Consider,
A = 19991999
< 20002000
= 22000 * 10002000
= 1024200 * 106000
< 10800 * 106000
= 106800

i.e. A < 106800
i.e. B < 6800 * 9 = 61200
i.e. C < 5 * 9 = 45
i.e. D < 2 * 9 = 18
i.e. E <= 9
i.e. E is a single digit number.

Also,
1999 = 1 (mod 9)
so 19991999 = 1 (mod 9)

Therefore we conclude that E=1.
There is a 50m long army platoon marching ahead. The last person in the platoon wants to give a letter to the first person leading the platoon. So while the platoon is marching he runs ahead, reaches the first person and hands over the letter to him and without stopping he runs and comes back to his original position.

In the mean time the whole platoon has moved ahead by 50m.

The question is how much distance did the last person cover in that time. Assuming that he ran the whole distance with uniform speed.
Submitted

The last person covered 120.71 meters.

It is given that the platoon and the last person moved with uniform speed. Also, they both moved for the identical amount of time. Hence, the ratio of the distance they covered - while person moving forward and backword - are equal.

Let's assume that when the last person reached the first person, the platoon moved X meters forward.
Thus, while moving forward the last person moved (50+X) meters whereas the platoon moved X meters.
Similarly, while moving back the last person moved [50-(50-X)] X meters whereas the platoon moved (50-X) meters.

Now, as the ratios are equal,
(50+X)/X = X/(50-X)
(50+X)*(50-X) = X*X

Solving, X=35.355 meters

Thus, total distance covered by the last person
= (50+X) + X
= 2*X + 50
= 2*(35.355) + 50
= 120.71 meters

Note that at first glance, one might think that the total distance covered by the last person is 100 meters, as he ran the total lenght of the platoon (50 meters) twice. TRUE, but that's the relative distance covered by the last person i.e. assuming that the platoon is stationary.

If you take a marker & start from a corner on a cube, what is the maximum number of edges you can trace across if you never trace across the same edge twice, never remove the marker from the cube, & never trace anywhere on the cube, except for the corners & edges?

9

To verify this, you can make a drawing of a cube, & number each of its 12 edges. Then, always starting from 1 corner & 1 edge, you can determine all of the possible combinations for tracing along the edges of a cube.

There is no need to start from other corners or edges of the cube, as you will only be repeating the same combinations. The process is a little more involved than this, but is useful for solving many types of spatial puzzles.
One of Mr. Bajaj, his wife, their son and Mr. Bajaj's mother is an Engineer and another is a Doctor.
 If the Doctor is a male, then the Engineer is a male.
 If the Engineer is younger than the Doctor, then the Engineer and the Doctor are not blood relatives.
 If the Engineer is a female, then she and the Doctor are blood relatives.
Can you tell who is the Doctor and the Engineer?

Mr. Bajaj is the Engineer and either his wife or his son is the Doctor.

Mr. Bajaj's wife and mother are not blood relatives. So from 3, if the Engineer is a female, the Doctor is a male. But from 1, if the Doctor is a male, then the Engineer is a male. Thus, there is a contradiction, if the Engineer is a female. Hence, either Mr. Bajaj or his son is the Engineer.

Mr. Bajaj's son is the youngest of all four and is blood relative of each of them. So from 2, Mr. Bajaj's son is not the Engineer. Hence, Mr. Bajaj is the Engineer.

Now from 2, Mr. Bajaj's mother can not be the Doctor. So the Doctor is either his wife or his son . It is not possible to determine anything further.

Three men - Sam, Cam and Laurie - are married to Carrie, Billy and Tina, but not necessarily in the same order.

Sam's wife and Billy's Husband play Carrie and Tina's husband at bridge. No wife partners her husband and Cam does not play bridge.

Who is married to Cam?

Carrie is married to Cam.

"Sam's wife and Billy's Husband play Carrie and Tina's husband at bridge."

It means that Sam is not married to either Billy or Carrie. Thus, Sam is married to Tina.

As Cam does not play bridge, Billy's husband must be Laurie.

Hence, Carrie is married to Cam.

There are 3 persons X, Y and Z. On some day, X lent tractors to Y and Z as many as they had. After a month Y gave as many tractors to X and Z as many as they have. After a month Z did the same thing. At the end of this transaction each one of them had 24.

Find the tractors each originally had?

One way to solve it is by making 3 equations and solve them simultaneously. But there is rather easier way to solve it using Backtracing.

It's given that at the end, each had 24 tractors (24, 24, 24) i.e. after Z gave tractors to X & Y as many as they had. It means that after getting tractors from Z their tractors got doubled. So before Z gave them tractors, they had 12 tractors each and Z had 48 tractors. (12, 12, 48)

Similarly, before Y gave tractors to X & Z, they had 6 & 24 tractors respectively and Y had 42 tractors i.e. (6, 42, 24)

Again, before X gave tractors to Y & Z, they had 21 & 12 tractors respectively and X had 39 tractors i.e. (39, 21, 12)

A certain street has 1000 buildings. A sign-maker is contracted to number the houses from 1 to 1000. How many zeroes will he need?

The sign-maker will need 192 zeroes.

Divide 1000 building numbers into groups of 100 each as follow:
(1..100), (101..200), (201..300), ....... (901..1000)

For the first group, sign-maker will need 11 zeroes.
For group numbers 2 to 9, he will require 20 zeroes each.
And for group number 10, he will require 21 zeroes.

The total numbers of zeroes required are
= 11 + 8*20 + 21
= 11 + 160 + 21
= 192

There are 9 coins. Out of which one is odd one i.e weight is less or more. How many iterations of weighing are required to find odd coin?

It is always possible to find odd coin in 3 weighings and to tell whether the odd coin is heavier or lighter.
1. Take 8 coins and weigh 4 against 4.
o If both are not equal, goto step 2
o If both are equal, goto step 3

2. One of these 8 coins is the odd one. Name the coins on heavier side of the scale as H1, H2, H3 and H4. Similarly, name the coins on the lighter side of the scale as L1, L2, L3 and L4. Either one of H's is heavier or one of L's is lighter. Weigh (H1, H2, L1) against (H3, H4, X) where X is one coin remaining in intial weighing.
o If both are equal, one of L2, L3, L4 is lighter. Weigh L2 against L3.
 If both are equal, L4 is the odd coin and is lighter.
 If L2 is light, L2 is the odd coin and is lighter.
 If L3 is light, L3 is the odd coin and is lighter.

o If (H1, H2, L1) is heavier side on the scale, either H1 or H2 is heavier. Weight H1 against H2
 If both are equal, there is some error.
 If H1 is heavy, H1 is the odd coin and is heavier.
 If H2 is heavy, H2 is the odd coin and is heavier.

o If (H3, H4, X) is heavier side on the scale, either H3 or H4 is heavier or L1 is lighter. Weight H3 against H4
 If both are equal, L1 is the odd coin and is lighter.
 If H3 is heavy, H3 is the odd coin and is heavier.
 If H4 is heavy, H4 is the odd coin and is heavier.

3. The remaining coin X is the odd one. Weigh X against the anyone coin used in initial weighing.
o If both are equal, there is some error.
o If X is heavy, X is the odd coin and is heavier.
o If X is light, X is the odd coin and is lighter.
In a sports contest there were m medals awarded on n successive days (n > 1).
1. On the first day 1 medal and 1/7 of the remaining m - 1 medals were awarded.
2. On the second day 2 medals and 1/7 of the now remaining medals was awarded; and so on.
3. On the nth and last day, the remaining n medals were awarded.
How many days did the contest last, and how many medals were awarded altogether?

Total 36 medals were awarded and the contest was for 6 days.

On day 1: Medals awarded = (1 + 35/7) = 6 : Remaining 30 medals
On day 2: Medals awarded = (2 + 28/7) = 6 : Remaining 24 medals
On day 3: Medals awarded = (3 + 21/7) = 6 : Remaining 18 medals
On day 4: Medals awarded = (4 + 14/7) = 6 : Remaining 12 medals
On day 5: Medals awarded = (5 +7/7) = 6 : Remaining 6 medals
On day 6: Medals awarded 6

I got this answer by writing small program. If anyone know any other simpler method, do submit it.
A number of 9 digits has the following properties:
 The number comprising the leftmost two digits is divisible by 2, that comprising the leftmost three digits is divisible by 3, the leftmost four by 4, the leftmost five by 5, and so on for the nine digits of the number i.e. the number formed from the first n digits is divisible by n, 2<=n<=9.
 Each digit in the number is different i.e. no digits are repeated.
 The digit 0 does not occur in the number i.e. it is comprised only of the digits 1-9 in some order.
Find the number.

One way to solve it is Trial-&-Error. You can make it bit easier as odd positions will always occupy ODD numbers and even positions will always occupy EVEN numbers. Further 5th position will contain 5 as 0 does not occur.

The other way to solve this problem is by writing a computer program that systematically tries all possibilities

1/3 rd of the contents of a container evaporated on the 1st day. 3/4th of the remaining contents of the container evaporated on the second day.

What part of the contents of the container is left at the end of the second day?

Assume that contents of the container is X

On the first day 1/3rd is evaporated.
(1 - 1/3) of X is remaining i.e. (2/3)X

On the Second day 3/4th is evaporated. Hence,
(1- 3/4) of (2/3)X is remaining
i.e. (1/4)(2/3)X = (1/6) X

Hence 1/6th of the contents of the container is remaining

Vipul was studying for his examinations and the lights went off. It was around 1:00 AM. He lighted two uniform candles of equal length but one thicker than the other. The thick candle is supposed to last six hours and the thin one two hours less. When he finally went to sleep, the thick candle was twice as long as the thin one.

For how long did Vipul study in candle light?

Vipul studied for 3 hours in candle light.

Assume that the initial lenght of both the candle was L and Vipul studied for X hours.

In X hours, total thick candle burnt = XL/6
In X hours, total thin candle burnt = XL/4

After X hours, total thick candle remaining = L - XL/6
After X hours, total thin candle remaining = L - XL/4

Also, it is given that the thick candle was twice as long as the thin one when he finally went to sleep.
(L - XL/6) = 2(L - XL/4)
(6 - X)/6 = (4 - X)/2
(6 - X) = 3*(4 - X)
6 - X = 12 - 3X
2X = 6
X = 3

Hence, Vipul studied for 3 hours i.e. 180 minutes in candle light.

If you started a business in which you earned Rs.1 on the first day, Rs.3 on the second day, Rs.5 on the third day, Rs.7 on the fourth day, & so on.

How much would you have earned with this business after 50 years (assuming there are exactly 365 days in every year)?

Rs.333,062,500

To begin with, you want to know the total number of days: 365 x 50 = 18250.

By experimentation, the following formula can be discovered, & used to determine the amount earned for any particular day: 1 + 2(x-1), with x being the number of the day. Take half of the 18250 days, & pair them up with the other half in the following way: day 1 with day 18250, day 2 with day 18249, & so on, & you will see that if you add these pairs together, they always equal Rs.36500.

Multiply this number by the total number of pairs (9125), & you have the amount you would have earned in 50 years.

Math gurus may use series formula to solve it.(series: 1,3,5,7,9,11.....upto 18250 terms)
A worker earns a 5% raise. A year later, the worker receives a 2.5% cut in pay, & now his salary is Rs. 22702.68

What was his salary to begin with?

Rs.22176

Assume his salary was Rs. X

He earns 5% raise. So his salary is (105*X)/100

A year later he receives 2.5% cut. So his salary is ((105*X)/100)*(97.5/100) which is Rs. 22702.68

Hence, solving equation ((105*X)/100)*(97.5/100) = 22702.68
X = 22176
At 6'o a clock ticks 6 times. The time between first and last ticks is 30 seconds. How long does it tick at 12'o.

66 seconds

It is given that the time between first and last ticks at 6'o is 30 seconds.
Total time gaps between first and last ticks at 6'o = 5
(i.e. between 1 & 2, 2 & 3, 3 & 4, 4 & 5 and 5 & 6)

So time gap between two ticks = 30/5 = 6 seconds.

Now, total time gaps between first and last ticks at 12'o = 11
Therefore time taken for 12 ticks = 11 * 6 = 66 seconds (and not 60 seconds)

500 men are arranged in an array of 10 rows and 50 columns according to their heights.

Tallest among each row of all are asked to come out. And the shortest among them is A.

Similarly after resuming them to their original positions, the shortest among each column are asked to come out. And the tallest among them is B.

Now who is taller A or B ?

No one is taller, both are same as A and B are the same person.

As it is mentioned that 500 men are arranged in an array of 10 rows and 50 columns according to their heights. Let's assume that position numbers represent their heights. Hence, the shortest among the 50, 100, 150, ... 450, 500 is person with height 50 i.e. A. Similarly the tallest among 1, 2, 3, 4, 5, ..... 48, 48, 50 is person with height 50 i.e. B

Now, both A and B are the person with height 50. Hence both are same.

In Mr. Mehta's family, there are one grandfather, one grandmother, two fathers, two mothers, one father-in-law, one mother-in-law, four children, three grandchildren, one brother, two sisters, two sons, two daughters and one daughter-in-law.

How many members are there in Mr. Mehta's family? Give minimal possible answer.

There are 7 members in Mr. Mehta's family. Mother & Father of Mr. Mehta, Mr. & Mrs. Mehta, his son and two daughters.

Mother & Father of Mr. Mehta
|
|
Mr. & Mrs. Mehta
|
|
One Son & Two Daughters
When Alexander the Great attacked the forces of Porus, an Indian soldier was captured by the Greeks. He had displayed such bravery in battle, however, that the enemy offered to let him choose how he wanted to be killed. They told him, "If you tell a lie, you will put to the sword, and if you tell the truth you will be hanged."

The soldier could make only one statement. He made that statement and went free. What did he say?