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.
Easy to follow O(n) one pass solution
Nice problem but let us return "recognized" instead of "recognised" for us North Americans who can't read :)
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?
im also having this exact problem, can you shed any light on it? using java