Ad
  • Custom User Avatar

    duplicate issue above

  • Custom User Avatar

    the flatten method is overridden for the tests, so this solution doesn't work at all

  • Custom User Avatar

    your solution doesn't work if initial array contains any other arrays inside - check test cases

  • Custom User Avatar

    your solution doesn't work if initial array contains any other arrays inside - check test cases

  • Default User Avatar

    Nice kyu, had fun. Thank you!

  • Default User Avatar

    i got past the last test with a simple if statement

  • Default User Avatar

    You don't need to loop through all the seconds of elapsed time. That's too time consuming.

    Instead, start with a description of the distance at which the faster tortoise will catch up to the slower one. For the first (slower) tortoise, this distance will be expressed as (v1 * time) + g. For the second (faster) tortoise, this distance will be expressed as (v2 * time). So start with the equation (v1 * time) + g = (v2 * time). Simplify that expression using normal math rules to isolate the time on one side of the equation.

    This will yield a time in hours, which you must still reformat as hours, minutes, seconds.

    I hope this helps without giving you too much.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • 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?

  • Default User Avatar

    Which language please (Javascript)? It not a problem of the kata (712 guys passed it and more than 100 in JS), it can be a CW problem and then report it as a bug or it is a problem of your code. The "Submit" tests are much much more numerous.

  • Custom User Avatar

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

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Hhahaha.. you made it so simple :)