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.
isnt this O(3n) -> O(n). instead of O(2n) -> O(n). what i want to say is that concating both of these lists will make the algorithm slower. Since you are traversing the list 3 times instead of twice. This is the code which is faster than the one above:
return arr1.reduce((sum, cur) => sum + cur) + arr2.reduce((sum, cur) => sum + cur);
cool
real🤣
Clean🔥
I second the approach but suggest creating the regular expression from the object keys.
This comment is hidden because it contains spoiler information about the solution
I really like this idea of filtering out the negative items first!
That's how I did it :D
wow your solution is better than mine
This comment is hidden because it contains spoiler information about the solution
Impressive)
practice more
goood job
Neat! Very clean.
Unrelated: reading your solution made Big O notation make sense to me. :)
Every item in the incoming array is processed twice, first to remove everything that's equal to or greater than zero to a fresh array, and then to sum every element of that new list. Every item is essentially touched twice so it's O squared, but technically maybe it's kind of smaller than that in an ideal case because the reducer only does its work on the resulting, probably smaller, subset of filtered numbers.
Thanks, I know this is sort of unrelated, I just needed to go off for a sec.
for initialitation
valeur a will begin with 0
Loading more items...