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.
Thanks man
Ahh, I wish I read this before I attempted to hammer the solution with randomness.
fixed by B4B
The solution can't overcome a time limit without an index. Therefore, an index is not useless here.
Index did nothing in this case, you scanned too much rows to bet useful.
Don't use it mindlessly at least count records before adding it to see if there is prospect for index use.
One of the tests expect (in JS) :
"Expected: 'twenty one minutes to seven'"
Is this correct maybe people say it like that, i don't know :D ?
Super good kata. Not only for exercise itself
but on ways to approach the problem and organize
the code. I saw solutions ranging from 20 - 170 lines
it just says how much organizing code can be challenge of itself.
Very sad that this kata have low traction it should be base line exercise to programmers.
Mark it as solved.
In other words, what hobovsky is saying is that you need to make a copy of input array.
Yes your loops take too long, after solving checked other people performance (in JS, wonder how C could improve) it was 8,5 - 11 s, so it is quite tight.
This should be a hint to you, that you have to rethink your solution and be VERY conservative with rereading array values to the point of reading only ...
"while (true)" conditions always seem wonky to me, not that it is bad but makes it harder to read code,
since it makes it more jumpy and non linear, when you look for loop termination condition.
With math you are moving in the good direction.
As for implantation, you know that you have problems with larger numbers and still do multiplication.
Just look at "numerator = 2757240" in the description example, thats crazy.
Try to work out math further to by pass this, so that you would not have such a larger number at one point of time.
Add code next time, it is hard to tell what the problem is.
As for test "Expected: Henry's socks", this hides with what values code was checked it is not the answer.
Punky have to have different color socks by description.
Since list contains only socks of one color no viable combination is possible.
In these cases description says to return empty array (or some equivalent in python).
I suggest to add some extra validating logic at the end of solution.
Loading more items...