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.
This is so hilarious, I've been laughing so much!
Oh, man, I'm impressed! If it's not difficult for you, where did you learn to program so "correctly":_)? Thanks
Yeah, php has a vulernability on codewars which makes any test without rng cases exploitable.
But there doesn't seem to be any activity on the platform from it's creators.
lol nice, at least it works for the test cases
This comment is hidden because it contains spoiler information about the solution
$this->check(basicOp('/', 4, 0), 0);
Division by zero :(
That is ok, pfela.
"Best" is a relative word and your solution seems to have better performance.
I just thoght in a simple solution, but you are right. I am using array_slice to retrieve something I could put in a cache and improve performance.
Sorry but this is not best practices. Sure it looks pretty with it being only a few lines of code but it's O(n^2) whereas my solution is O(n).
Let n = 10000;
Runtime for this solution ~= 0.0433 seconds
Runtime for my solution ~= 0.0017 seconds
Let n = 100000;
Runtime for this solution ~= 4.8142 seconds
Runtime for my solution ~= 0.0169 seconds
Let n = 1000000;
Runtime for this solution == Fails (out of memory after running locally for over 15 minutes)
Runtime for my solution ~= 0.1612 seconds