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.
Each length is calculated twice, so I can't even tell without testing if caching would help or not. And the complexity is just
O(n * log n)
, the group lengths are not independent of the list length, they are made of the same items.It has approximate time complexity
O(n log n)
. ( I already thought so. But I checked. ) Your C or assembly solution might have time complexityO(n)
, but will very, very probably also haveO(n log n)
.No,
length
is not cached. But even without, time complexity is something like(O m n log n)
withm
the length of the longestgroup
. That's approximately a small constant except in extreme cases. Caching length would be a good thing here.This comment is hidden because it contains spoiler information about the solution
I just checked, this looks covered.
I expect quickcheck to test for the empty list !
Tests do not check myMinimum on empty Foldable (I assume it should be Nothing)
Is that better now ? (note : I don't think tests are updated when a kata is retried, you'll have to check the kata details ..)
This comment is hidden because it contains spoiler information about the solution