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 was a genius way to solve this problem. Kudos to you.
Same here. Nice to learn something new everyday:)
That's clever!
I don't know why i didn't think in replace method
This comment is hidden because it contains spoiler information about the solution
I took another look at it today and appears that indeed my negation parsing was not binding tightly enough! Thanks for the help.
-7891910.6360572055
seems to be the correct result. Have you changed the order of operations anywhere (even addition isn't associative for floating point numbers) or usedFloat
instead ofDouble
? If not, post your code here flagged as a spoiler.This comment is hidden because it contains spoiler information about the solution
Nice! So clean
It can't. It's a pure C solution, requiring the minimal possible operations to get the expected result, and is optimized to do the mapping after the filtering but before the expansion step. Your solution, on the other hand (idk whether you were referring to it as faster but still), is 10 times slower in the worst case (no spaces), and hundreds of times slower in the best case (only spaces).
It's hard to judge actual speed of python based on theoretical time complexity, it varies a lot depending on user implementation and the internal C implementation of that code. For example, a, b = min(list), max(list) is usually a bit faster than iterating once with a for loop. Your solution is about 4-5x slower, from my tests at least.
Or just look at the source of
ListOf1
and writeListOf5
. I've done that forListOf2
once, I think.But
1
to50
will do nicely.( Shouldn't you be implementing
concat
somewhere? I just realised that if you havefoldr
, you can haveconcat
. Just Hoogle it. :)https://www.codewars.com/kumite/5da2629de0aad70026c7291a?sel=5da27e8a8b5fcc99f2a4852b
This is almost the same as Python, except the list size is from 1 to 50 instead of 5 to 50 - I hope that's okay.
If not, I can fix it with some nitty gritty
<$>
and<*>
stuff. (I learned that from some of your translations. Clever, but useful. Took me a while to get the hang of it tho.)You're using the default random generator, which is a bit simplistic for this kata. Could you try to generate something more approaching normal text, like the random generators in JS ( the original ) and Python ( which you solved ) do?
Loading more items...