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.
Which language ? Python ?
Updated JS version with randomized tests
updated in this fork
rust version with (pseudo-randomized tests
This comment is hidden because it contains spoiler information about the solution
Flabergastingly not efficient yet beautiful.
Take my neverending admiration
Any idea why I can't use Array.flatMap() in js ?
well, I guess I miss something, then :/
I'm doing this kata in js. Everything is fine and working, just trying to speed up things.
I see that people speak about 200 AST tests to pass. I do not have a clue about what it means.
So far, my code can run some ~2000 chars generated tests in ~4.3ms. (taken from the "attempt" tests via console.log)
Any way to measure if I'm still far from the speed required ?
Can I have an exemple of those "AST test" so I can measure my speed against 200's of them ?
How do you know how much randomized tests you passed ?
I can't seem to output anything once those starts. (JS)
yes, you could :
My choice fot the regex is that I could inline it and also it works with only oue group without puting in more conditions.
Guess i just forgot to remove it. oopsie.
In terms of effectiveness, 5 loops resulting in 10 statements is arguably nitpicking.(like µs nitpicking)
In terms of simplicity, "x>0" is understandable as "for positive numbers". "x>=5" is more complicated and raise a flag in the head of the developper like "mmh why has this a minimal value? what does it mean ?".
As a rule of thumbs, when you want to code clean, the best pratice is to avoid "magic numbers" and to achieave simplicity.
If your goal is nitpicking effectiveness, look into "clever solutions" and "code golf". Annnnd good luck for the maintenance :)
48 is the ascii code for "0". So :
"0".toLong()-48 = 0L
"8".toLong()-48 = 8L
loop would not be so obvious to do nor to read.
chaining some method maybe ...
Loading more items...