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.
Sorry for accusing you of that. :P Problem may have been that the reference solution was modifying its input.
Is this issue resolved now that JohanWiltink has updated the javascript translation?
You were modifying the input, weren't you? :]
There was a little problem with my code which made it super slow. Now only
O(n)
solutions should pass.Glad you liked it :)
Hmm. I wrote the Python and Ruby translations but not the JavaScript because I was unfamiliar with the bigInt library. Thanks for letting me know, I'll have to see about trying to make it so true n^2 solutions (and your second solution does appear to be one) fail. That's certainly the shortest solution I've seen yet :)
If you were mutating the array, then the tests were generated improperly, Now the tests are corrected to be generated correctly
sorry, the reference solution still returns
false
on that test case.Details in performance tests:
So, it seems no problem ;-)
My solution's results:
Random test is reusing the same array object to perform its own computation to check if your solution is valid, so you shouldn't mutate the original array.
Thanks, glad you liked it!
Thanks, @kazk!
@Grae-Drake, the example is correct.
The idea is:
Applied to
numbers
[2.0, 2.0, 3.0, 4.0]
andrules
[(a,b) => a + b, (a,b) => a - b]
CodeWars seems to have made some changes. I revised the kata and it should work for you now.