@above
[20, 20, 3, 42]
regards
- Sumit Kumar Pathak
(Sumit/ Pathak/ SKP ...)
*Smile is only good contagious thing.*
*Spread it*!
On Mon, Feb 4, 2013 at 7:40 AM, navneet singh gaur <
navneet.singhg...@gmail.com> wrote:
> I guess it doesn't require a DP, I might have understood your question
I guess it doesn't require a DP, I might have understood your question
wrongly but from what I have understood solution is as follows :
S = sum at a particular point
A[N] = array which contains guard's respective demands
i = 0, S=0;
while (i < N)
{
if (A[i] >= S)
{
S += A[i];
}
i++
You have N guards in a line each with a demand of coins.You can skip paying
a guard only if his demand is lesser than what you have totally paid before
reaching him.Find the least number of coins you spend to cross all guards.
I think its a DP problem but cant come up with a formula.Another appro
we have many machines connected to each other. However, administering these
machines is a great hassle. That is because a machine can be administered
only by a machine connected directly to it (a machine that is an
administrator can administrator itself). So, the system administrators have
decided