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 comment is hidden because it contains spoiler information about the solution
I could have made the type
Iterable
instead ofArray
, but it's too late now.Could have made the type
Iterable
instead ofArray
but it's too late now.I haven't simplified the formula very much, but this is basically my mental model of how it works.
The case expression also makes for stylish Erlang =D
For the record, Erlang arrays aren't implemented as C-style arrays, but are a different (and purely functional!) data structure. Your basic operations aren't exactly O(N), either:
https://stackoverflow.com/questions/16447921/arrays-implementation-in-erlang
I'd forgotten that CodeWars doesn't trim trailing empty lines.
Don't be a hater! Upvote if you like the code, regardless of my fail in submitting!
Well done, sir, you've passed the coding interview. Now, tell us what sort of compensation you were expecting while we prepare your office for you 😂😂😂
Didn't mean to choose the same name for my package alias and my argument to reverse, but oh well! xD
This comment is hidden because it contains spoiler information about the solution
I used recursive groups.
Check my Haskell solution to see how I did it, and pass me an upvote if you like my style (I don't have many!)
(...Hey, I might be able to do it even better in a language which has all the latest PCRE features—maybe I'll try and solve it for some other languages!)
Everyone's given you "Clever" when this is actually "Best Practices" from a functional programmer's point of view!
Well, I've written a really nice solution, but it outputs the letters in a different order to that expected (not mentioned in the kata description, incidentally!)
Because I'm so happy with the code I've written, I don't want to solve this kata, now. It does everything according to the description, but doesn't pass the tests which expects the letters to be ordered. Shame!
I think this is the most readable and best way to do it.
I thought of this but didn't know if only integers were used! It's a cute solution, given that seems to be the case 😁
That would be a GREAT kata.
Loading more items...