So if u travel 5 km uphill and then 5 km on plain and then 5 km on downhill then time taken
by you will be equal to 15 km on the plain road
This is not the truth.
5/72 + 5/64 + 5/56  - 15/64  = 5/72+5/56-10/64 = 10/63-10/64 > 0
(that is solely due avg of speed of downhill and uphill is = speed on plain road)
This only leads to:
if u travel 5 hrs uphill and then 5 hrs on plain and then 5 hrs on downhill then distance traveled
by you will be equal to travel 15 hrs on the plain road.


On 2010-9-15 15:07, rahul patil wrote:
the solution seems to be simple.
Just try to imagine what is happening

You have a road with downhill and uphill.
So if u travel 5 km uphill and then 5 km on plain and then 5 km on downhill then time taken by you will be equal to 15 km on the plain road(that is solely due avg of speed of downhill and uphill is = speed on plain road)

so the from A to B we reach 40 min earlier due to there more downhill road.
while from A to B it is uphill.

So let us take x km as the road distance which is not plain.

t1 = time to travel x on downhill = x/72
t2 = time to travel x on uphill = x/56

but as given 40min =  2/3 hr = x/56 - x/72

so, x= 168.

so it will take 3 hrs to climb while travelling from B to A and plain road distance = 5/3 * 64 = 106.67 km
dist = 168 + 106.67
On Wed, Sep 15, 2010 at 8:21 AM, Terence <[email protected] <mailto:[email protected]>> wrote:



    You could also get a unique solution if the car has speed of 72 63 56

    in downhill, plain and uphill respectively.

    I think the speed Vd, Vp, Vu was chosen so that 2Vp = Vd + Vu.
    But for unique solution, it ought to be 2/Vp = 1/Vd + 1/Vu.

    Under this condition, we can get the unique S=x+y+z:
    From
      x/Vd + y/Vp + z/Vu = T1
      x/Vu + y/Vp + z/Vd = T2
    We get (1/Vu+1/Vd)(x+z)+2/Vp*y = T1+T2
    Apply 2/Vp = 1/Vd + 1/Vu, then 2/Vp(x+y+z)=T1+T2
    S=x+y+z = Vp(T1+T2)/2



    On 2010-9-15 9:31, Gene wrote:

        This isn't right.  Dropping both y terms is the same as
        setting y to
        zero.  The answer you get is correct, but there are many
        others as has
        been said.

        You could get a unique solution if the route were constrained
        to be
        monotonic (level and up or else level and down).

        On Sep 14, 4:28 pm, Minotauraus<[email protected]
        <mailto:[email protected]>>  wrote:

            Actually the solution is unique. The middle part with the
            Ys is the
            same and therefore can be omitted out. Now you are left with
            2 equations and 2 unknowns.

            I used time in minutes and I have x = 1.28, z = 0.30476
            units (y can
            be found out).

            I guess the trick was 1. to write the equations that Yan did
            and 2. to recognize that the plain part is the same and
            hence can be
            cancelled.

            On Sep 14, 3:31 am, Yan Wang<[email protected]
            <mailto:[email protected]>>  wrote:



                actually, there are many solutions, just pick up one
                from them...
                On Tue, Sep 14, 2010 at 3:23 AM, Abhilasha jain
                <[email protected]
                <mailto:[email protected]>>  wrote:

                    how can u solve 3 variables using 2 equations?
                    On Tue, Sep 14, 2010 at 3:44 PM, Yan
                    Wang<[email protected]
                    <mailto:[email protected]>>  wrote:

                        x/72 + y/64 + z/56 = 4
                        &
                        x/56 + y/64 + z/72 = 4+2/3
                        find a solution to this ...
                        On Tue, Sep 14, 2010 at 2:31 AM,
                        bittu<[email protected]
                        <mailto:[email protected]>>  wrote:

                            Amazon Interview Question for Software
                            Engineer / Developers
                            A car has speed of 72 64 56 in downhill,
                            plain and uphill
                            respectively . A guy travels in the car
                            from Pt. A to pt. B in 4 Hrs
                            and pt. B to pt. A in 4 Hrs and 40 min.
                            what is the distance between A
                            and B?
                            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
                            [email protected]
                            <mailto:[email protected]>.
                            To unsubscribe from this group, send email to
                            [email protected]
                            <mailto:algogeeks%[email protected]>.
                            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
                        [email protected]
                        <mailto:[email protected]>.
                        To unsubscribe from this group, send email to
                        [email protected]
                        <mailto:algogeeks%[email protected]>.
                        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
                    [email protected]
                    <mailto:[email protected]>.
                    To unsubscribe from this group, send email to
                    [email protected]
                    <mailto:algogeeks%[email protected]>.
                    For more options, visit this group at
                    http://groups.google.com/group/algogeeks?hl=en.-
                    Hide quoted text -

            - Show quoted text -


-- You received this message because you are subscribed to the Google
    Groups "Algorithm Geeks" group.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:algogeeks%[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/algogeeks?hl=en.




--
Regards,
Rahul Patil
--
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to