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.
What is supposed to be returned on (1,-1) or (-1,1)? I thought it might be zero, according to kata's description. Why am I wrong?
Might O(n^3) be a complexity of your algorithm because of
tails
(producing O(n) lists),map inits
(inits
for each list produces O(n) sublists) andmap sum
that sums each of O(n^2) sequence obtained after previous operations?If it is, this solution is not efficient as it could be.
Could you argue why your solution is more efficient that this one, especially considering that GHC (and others) increases its ability of optimization every year.