Gold box problem

There are ā€˜nā€™ gold boxes placed in a row, each having different number of gold coins.
2 players play a game, where the motive is to collect the maximum number of gold coins. Each player can see how many coins are present in each box, but can get a box from either end only, on his turn.
Design a strategy such that Player1 wins (Assuming both players play smartly)

Source: Amazon Interview

Find Solution here

Duck and Fox

A duck is swimming at the center of a circle-shaped lake. A fox is waiting at the shore, not able to swim, willing to eat the duck. It may move around the whole lake with a speed four times faster than the duck can swim. Can the duck always reach the shore without being eaten by the fox?

Source: Raphael Reischuk Riddles

Find Answer here

Hats on a Death Row

You are one of 20 prisoners on death row with the execution date set for tomorrow. Your king is a ruthless man who likes to toy with his people’s miseries. He comes to your cell today and tells you:
“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row (queue) before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in any way (talking, touching…..).

The prisoner in the back will be able to see the 19 prisoners in front of him. The one in front of him will be able to see 18…

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?

He will be only allowed to answer “BLACK” or “RED”. If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the one in front of him and ask him the same question and so on…

Well, good luck tomorrow, HA HA HA HA HA HA!”

Now since you all can communicate freely during the night, can you find a way to guarantee the freedom of some prisoners tomorrow? How many?

Source: www.brainden.com

Find Answer here

2 Goats and 1 Car

You are on a game show and there are three doors. The presenter tells you that behind one of doors there is a car and behind the other two are goats. If you pick the car you win it. After you have picked a door the presenter opens a different door with a goat behind it, he then gives you the chance to change what door you open. What should you do?

Hint: It is not 1/2 as you would first think.

Find Answer here

Find the Number

Find the smallest number with the given properties

When I divide it by 2, the remainder is 1.
When I divide it by 3, the remainder is 2.
When I divide it by 4, the remainder is 3.
When I divide it by 5, the remainder is 4.
When I divide it by 6, the remainder is 5.
When I divide it by 7, the remainder is 6.
When I divide it by 8, the remainder is 7.
When I divide it by 9, the remainder is 8.
When I divide it by 10, the remainder is 9.

Got the answer??
Find Answer here

The Dream Job

You are one of the 125 candidates that have been shortlisted to appear for an interview for a job in the company Amgon that pays five lakhs per month. Mr. Donny, a representative of Amgon is in the interviewing panel and he is responsible to select only one candidate for the job. He gives each candidate the same task in which he gives three dice each to every candidate. No marking of any kind has been done on any of the six faces of the dice. He tells them to write one letter each on all the faces of the three dice so that the top faces of the dice can show first three letters of all the months in the year. Can you complete the task and get the job?

Source: www.testfunda.com

Find Answer here

One Cord

You are given one cord that burns exactly one hour, not necessarily with constant speed.
How should you light the cord in order to determine a time interval of 15 minutes?
(Hint: solve the Two Cord puzzle first.)

Source: Raphael Reischuk

Find Answer here

Two Cords

You are given two cords that both burn exactly one hour, not necessarily with constant speed.
How should you light the cords in order to determine a time interval of exactly 15 minutes?

Source: Raphael Reischuk

Find Answer here

Knapsack Problem

Given weights and values of n gift items. We have a box of capacity W. Find a solution such that the total value of gifts in the box is maximum.
In this Problem, we have two integer arrays value[0,1,2,…,n-1] and weight[0,1,2,3…,n-1],it represents the values and weights associated with n items resp. Given an integer W which represents the total capacity of the box. Write a Program to find the maximum value V which is the sum of the subset of values (value[]) such that the sum of the weight of this subset is smaller than or equal to W.
We either have to pick the complete gift item or don’t pick it.

Also known as 0-1 Knapsack Problem because we cannot split the item mentioned. Either we don’t pick the item (i.e 0) or pick the complete item (i.e 1).

Source: www.geeksforgeeks.org
Find Solution here