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.
still O(n) tho
@lvsz
map
andsum
should fuse into one fold. but your solution is more explicit in this.That's still two passes, you ought to use
foldl
tomap
&sum
concurrently in a single pass.Just press 'View Solution' under my comment.
How do you do it without two passes?
Two passes. Bad.
Two passes. Bad.
Two passes. Bad.