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.
https://www.codewars.com/kumite/5c9145f0bf3fcd7d074b93c0?sel=5d750b35227865001fcb349a
Merge conflict. Fork and resolve conflicts in the description.
The tests have been updated now to be consistent.
The fixed tests have actual values first, so the random tests should have actual values first too for consistency.
Approved the update. Thank you so much for looking into this and sorting :-)
I've been playing around with this and I'm not sure why it is timing out. When I timed this implementation and put it against mine, it was about twice as slow for large strings (~3000 characters) but almost identical for small strings. But the weird thing is, even though it was twice as slow, I could only get it to pass around 10 random tests before timing out while mine could pass all 100 tests.
However, I did find an error in how large the strings were for the random tests. The other languages have random strings where the length is between 0 and 100 characters. The clojure tests were doing between 0 and 3000 characters.
Here's the fix for that bug and hopefully that will make your implementation pass. https://www.codewars.com/kumite/5c89cc3ead83841ec16a0e1d?sel=5c991d09d74b05250a1129d2
This comment is hidden because it contains spoiler information about the solution
Clojure Translation: https://www.codewars.com/kumite/5c9145f0bf3fcd7d074b93c0?sel=5c9145f0bf3fcd7d074b93c0
Java has dynamic arrays called ArrayList.
But your solution doesn't need them, just think about what Chrono79 said.
It is possible to know its size beforehand.
Strings in Java are immutable, but if you reassign them, your command should do what you want.
str = str.replaceAll(" ","");
If you want to remove all non-visible characters (e.g. tab, \n), go with:
str = str.replaceAll("\s+","")
Definitely. I'll keep an eye out for any issues.
First Clojure translation, thank you :-)
I have little knowledge of Clojure so if there are any errors that are noticed in the first few days please could you fix them.
Clojure Translation
Here's a clojure translation :)