Starting with any pump A, try to finish the circle, if at pump B that can
not reach pump B+1, it means all pumps from A to B can not finish the circle
(it will go broke at pump B), then just start with B+1. After go through all
the pumps start from some pump, we got an answer. if we go back to pump A
and later, still can not find an answer, there is no answer.

On Sat, Jan 29, 2011 at 4:38 AM, sankalp srivastava <
richi.sankalp1...@gmail.com> wrote:

> I'm sure you have misstated the problem statement
>
> just find out the total path length and return the first petrol pump
> which gives you the required milage
> go greedy
>
> On Jan 28, 5:09 pm, bittu <shashank7andr...@gmail.com> wrote:
> > There are N petrol pumps along a circular path. Every petrol pump
> > gives some amount of fixed petrol. Need not to be unique and in no
> > particular order means it is random. We have a car and we need to find
> > a petrol pump which can provide so much of petrol that we can take a
> > full of the circle. Mileage of car is fixed.
> > Distance between adjacent petrol pumps are given.
> >
> > Thanks & Regards
> > Shashank
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to