Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
duplicate issue above
the
flatten
method is overridden for the tests, so this solution doesn't work at allyour solution doesn't work if initial array contains any other arrays inside - check test cases
your solution doesn't work if initial array contains any other arrays inside - check test cases
Nice kyu, had fun. Thank you!
i got past the last test with a simple if statement
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.
This comment is hidden because it contains spoiler information about the solution
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.
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
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?
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.
im also having this exact problem, can you shed any light on it? using java
This comment is hidden because it contains spoiler information about the solution
Hhahaha.. you made it so simple :)