• ###### trashy_incelcreated an issue for "Candy count" kata

there is an empty test block `Candy count` with no assertions in it in the full tests, which therefore looks like a failed test

• ###### Voilecreated a suggestion for "Candy count" kata

Extra challenge:

• use object oriented programming

No. 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.

• ###### RShieldscommented on "JS/CoffeeScript Test Reference" doc

I would agree wholeheartedly that the best way to filter unoptimized programs is to run a ton of cases and cases with high n.

• ###### Voilecommented on "JS/CoffeeScript Test Reference" doc

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

• ###### RShieldscommented on "JS/CoffeeScript Test Reference" doc

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.

• ###### Voilecommented on "Validate credit card expiry date" kata

I wasn't talking about the tests, I was talking about the solutions. See my solution.

• ###### JohanWiltinkcommented on "Validate credit card expiry date" kata

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.

• ###### Voilecreated an issue for "Validate credit card expiry date" kata

Wait, how did this got approved?

• Description is confusing: `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 valid
• Example tests are even more confusing: `should 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 either
• In general, it's not a good idea to make a kata that relies on time, because then solutions get invalid as time passes
• ###### pw108resolved an issue on "Candy count" kata

Good call. I corrected it. Should be fine now.

• ###### kazkcreated an issue for "Candy count" kata

kids are not "playing together" in your performance tests:

``````function candyCount(kids, actions) {
console.log({kids, play: actions.filter(x => x > kids)});
// ommitted
}

// Basic tests
// { kids: 5, play: [ 8 ] }
// { kids: 7, play: [ 9, 9, 9 ] }
// { kids: 1, play: [ 2, 3, 2, 8, 2, 2 ] }

// Random tests
// { kids: 65, play: [ 67, 66, 66, 67, 66, 67 ] }
// { kids: 98, play: [ 99, 99, 99, 99 ] }

// Performance tests
// { kids: 296, play: [] } // For 157550 acts (length of actions array) and 296 kids
// { kids: 101, play: [] } // For 119526 acts (length of actions array) and 101 kids
// { kids: 769, play: [] } // For 179617 acts (length of actions array) and 769 kids
// { kids:   n, play: [] } // ... for all test cases
``````
• ###### pw108commented on "Candy count" kata

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.

• ###### kazkcommented on "Candy count" kata

@pw108, maybe the most accurate way to test for time complexity better than `O(N*M)` is to design some test with `N` and/or `M` large enough so that `O(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 using `process.hrtime([time])` and testing execution time for `n` 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 :)

• ###### pw108commented on "Candy count" kata

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).

• ###### pw108commented on "Candy count" kata

Thanks. Sorry for the spell check.... and also for making it clearer.

• ###### JohanWiltinkcommented on "Candy count" kata

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.