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.
no ifs, but you have an isPresent :)
This comment is hidden because it contains spoiler information about the solution
while readable, short and concise this is not best practice: the array is traversed twice and to the end instead of returning the result as soon as it is found.
Really neat!
I like your solution, but is not performant as the comment suggest. Or better, it would not perform well with a large number of strings. It's a nested for loop, so it is a quadratic algorithm. But with only ten strings this works well.
Spot on, you are right. I had updated my solution months ago to performa a linear scan rather than a sort, but it looks like the model solution cannot be updated. (or maybe I just don't know how!!). I have to cover up your question as it shows how to solve the kata.
Thanks, I've approved :)
Hey, thanks for the translation.
Let me point out a couple of things:
I, like you, at the beginning solved it by sorting the arrays first. Somebody though pointed out that it wasn't really a "model solution" at least in term performance. It takes ~ O(n log (n)) to sort an array, whilst it takes only linear time for a scan ( O(n) )
It is worth to add some tests including values for min and max interger as comparison of two int not done properly could result in overflow.
Thanks
This comment is hidden because it contains spoiler information about the solution
Any idea why the 3rd test would fail as
Should return its argument the first time. - Expected: 1, instead got: undefined
The logic of invoking the first time only should be correct
Neat!
Hi, I'm going to approve the translation, however, as I 've little knowledge of Python, I'm going to need your help to fix potential issues arising from the python kata. :)
Thanks for providing a translation.
No worries Matt, I found the bug and fixed it. There are only some style issues that I am in no position to comment on.
Hey thanks for reporting the issue. I had a look a the js translation of the kata and I believe I found the problem with the random tests. Could you please try again and let me know.
As per your first question maybe Matt, who provided the translation, could shade some light. I am in no position to discuss javascript best practices.
Hey thanks for reporting the issue. I had a look a the js translation of the kata and I believe I found the problem with the random tests. Could you please try again and let me know.
Loading more items...