Ad
  • Custom User Avatar

    Easy to follow O(n) one pass solution

  • Custom User Avatar

    Nice problem but let us return "recognized" instead of "recognised" for us North Americans who can't read :)

  • Custom User Avatar

    Do I not understand the description? Or was the description poorly written ^^?

    Yes, it takes 1938.4615 seconds, and yes, the description says to not worry about fractions of a second, but then you still have:

    1938 => not caught up yet
    1938.4615 => caught up (ignore)
    1939 => caught up & passed

    The first 'whole' (whole because we are ignoring fractions of a sec) second after Tortoise B has caught up is 1939.

    Let's say an apple can be sliced up to 4 pieces, and you want to know when you have enough apples for 10 pieces (2.5), don't worry about fractions of an apple. Do you still say 2 apples? No, it would take you 3.

  • Default User Avatar

    In fact the time needed is about 1938.4615... but you don't really well read the description:-) it is said: don't worry for fractions of second... Do you understand that point? Otherwise tell me

  • Custom User Avatar

    So I'm a little confused here. The first example you have of:

    race(720, 850, 70) => [0, 32, 18]

    is equal to 1938 seconds.

    At exactly 1938 seconds, A will have moved 457.6 ft, while B will have moved 457.583 ft: ((850 / 60) / 60) * 1938. B has not yet caught A at 1938 seconds.

    So, wouldn't it actually take 1939 seconds for B to catch A? I'm confused as to why the correct answer returns 18s instead of 19s. What am I missing here?

  • Custom User Avatar

    im also having this exact problem, can you shed any light on it? using java