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.
While trying to solve: "Wow, this is a lot harder than I thought"
After solving, looking at the top-solution: "Oh, yeah, alright..."
This is a thing of beauty.
Yeah, it's a six at least. My best guess is that people ranking kata's are mostly high ranks that tend to underestimate difficulty.
I've solved 4kyu's that were easier than this one.
Just what I thought.
I'm an idiot.
nice
I actually googled "CTE" and that popped up as the first result. So I scrolled down, looking for something else, because surely something medical had to be a false positive - but couldn't find anything else. It's not bad as an inside joke, but can I suggest
"concussions"
to make it clearer as a joke? It really confused me; normally, in untyped languages, the suggested return value is an example of an actually possible return value.If you have a nice tests to share, i would gladly add some
CTE - Chronic Traumatic Encephalopathy
Some of the ants for sure will injury themselves, by multiple headbumps.
I fixed the rest :), thanks for the feedback and translation!
Fair enough. 👍
It's all less than ideal. ETA: partially because JS lacks appropriate types, and partially because of questionable design.
The input
should have beenis a list of enums, the output a list of unsigned ints. The specific encodings of all those don't actually matter all that much.In JS,
String
behaves much like anArray
ofChar
, so the input isn't all that bad ( and JS doesn't haveEnum
s ETA: exceptBoolean
s actually ). The output would have been much better encoded as someArray
though ( and JS doesn't have unsigned ints either ETA: actually, it does, for list elements ).ETA: ideally, idiomatically, the input would have been an
Array
ofBoolean
s, and the output anArray
ofNumber
s, or, fancily, anUint32Array
, because anything smallermightwould overflow its elements for theN=1e6
case. The input might have been encoded as a ( signed or unsigned )Int8Array
withLeft
andRight
encoded as particular 8-bit numbers ( possibly several; think zero and non-zero ), which would save some storage over saidArray
ofBoolean
s. Especially for the output, stringifying it is just unnecessary overhead.Stringification is always suspect; it's not so much an encoding as it is a serialisation, mainly for display-to-human purposes. At least it has decent language support ( in normal languages. in LC, there is none :P ).
Haskell translation
You can add your own testcases. ( I did. )
And yes, there is an
O(n)
solution.I think there's a O(2n) or even O(n) solution, but the test cases are not really helpful to verify my ideas.
Nice one to figure out how to solve, a little bit of a riddle.
Loading more items...