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 solution uses two loops (filter and sum) instead of one for loop in the traditional one. So yes, in the terms of performance this is definitely not the best solution.
Question! does it return 0 when the array is empty or has just a 0? I guess so. It wouldn't be approve otherwise but I was not sure about it and my approach was pretty similar instead I used v -> v >= 0, maybe unnecesary after a double check 🤔
it's very conventient once you wrap your head around it and will trivialize a lot of problems
ong, i didn't know that thing existed
I did not know that Java has functional patterns / iterators. Nice!
me rn xd
Using loops hurts my brain less, I'm still trying to wrap my head around streams
just bookmarking this
you used stream because it looks cool, i used stream because i'm too lazy to type a loop solution.
we are not the same.
noice hahaha. i like this one
Clever solution, but for this particular Kata I prefer the traditional for loop.
Hi @tfuerholzer, I'd really like to get this Kata translated to Kotlin.
I forked your translation, and proposed a solution which already uses Kotlin 1.5 features.
You may have a look. Let's get this thing approved!
I'll never use Streams for small data, or simple loops like this one. This is easily a one liner with a for loop and the gain in readability is probably none.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
Loading more items...