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.
there is an empty test block
Candy count
with no assertions in it in the full tests, which therefore looks like a failed testNo. Please, just no. Remove the last part.
You might as well ask people to "use functional programming" to finish the kata. It's a pointless buzzword.
I would agree wholeheartedly that the best way to filter unoptimized programs is to run a ton of cases and cases with high n.
There is a rough way of determining time complexity though: Because time complexity is asymptotic, once input is sufficiently big you can test how the runtime scales with input size.
Or, of course, you can just make really huge inputs and perform a stress test with time/memory constraint. Then the subpar algorithms will be choked to death :P
Time complexity is not determined by a test. It's generally determined by a human.
Your time complexity is determined by how many loops you need to do and what you do in each loop. If you do a loop over an array once, you have O(n). If you loop over an array for each element in the array, you have O(n^2). Sorting an array with quicksort usually takes O(nlogn) (log base 2), but bubble sort takes O(n^2). Generally, pick the average case, but there are situations in which you want to report the worst case.
I wasn't talking about the tests, I was talking about the solutions. See my solution.
Have you read the tests? He's taken care of passing time. (Though there may be a bug on 29 Febrary and 31 August, October and December.)
I don't think the description and the tests are that confusing.
There could be more testing with separators other than
/
, but all in all I don't think it should not have been approved.Wait, how did this got approved?
These are separated by at least 1 character, but can be more
, so anything can be inside, but by how the example is listed it looks like that only those few are validshould work with xxx
followed by a date in the past which returns false? The individual test description are not really descriptive of the test in question eitherGood call. I corrected it. Should be fine now.
kids are not "playing together" in your performance tests:
Thanks. I added test as suggested by @myjinxin. I wasn't sure how to make Codewars time out as @kazk said. I run ir few times, and I think I found a time limit that should work for some obvious mistakes.
I will be happy for more feedback on it.
@pw108, maybe the most accurate way to test for time complexity better than
O(N*M)
is to design some test withN
and/orM
large enough so thatO(N*M)
solution takes longer than the time allowed by CodeWars.@myjinxin2015, I've been thinking that your performance measurement code can be improved, but had low priority because I know you fix issues very quickly and haven't seen complaints.
I'm mainly concerned with the use of
Date
to measure small milliseconds and testing each call's execution time. I think usingprocess.hrtime([time])
and testing execution time forn
calls will be better.I might make a suggestion comment in one of your performance katas if I find time to write in more detail :)
I actually not sure how to test for time complexity. I read the documentation on Test, but couldn't find any reference to it. I would really appreciate help with it.
One could be tempted solve the problem by interagating through each time when the kids play, and fill the whole array with max. That would make it O(N*M). But it can be done O(N+M).
Thanks. Sorry for the spell check.... and also for making it clearer.
I've tried fixing it up a bit more.
One should really only read from "for simplicity .." to "the goal is .."; the rest is quite unessential, though a nice story.
Loading more items...