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.
Coming from Haskell, I find it hard to use loops (even though I've used JavaScript for two years before learning Haskell). When I started solving katas in JavaScript, I kept on trying to use recursion instead of loops because it was faster. But soon learnt that it's not.
We've got a similar solution 😎
Only thing that's different is that I used
foldl'
instead offoldl
becausefoldl'
tends to be faster and less "lazy".I've tested this solution out, and if we give a list like
[1, 1, 2, 3, 4, 5, 6]
, I get back 6. If I give it the list[1, 1, 2, 3, 4, 5]
, I get back 0.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
And here I implemented Kadane's algoritm in a recursive fashion... 😩
I need to really learn
scanl
😅I didn't know Haskell had multi-line comments 😲
Thanks for your explanation!
Hey there!
It seems as though the tests run for both lowercase names and uppercase names. (e.g., "Edwin" and "edwin").
Wait, wha- 🤯
This comment is hidden because it contains spoiler information about the solution