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.
Solution 1 is clean and efficient!
Single loop for counting & summing
Explicit empty-array check
No unnecessary list creations
Perfect balance of readability and performance
Pythonic and maintainable! 🐍💡
I used
bisect
to efficiently find the breaking point between negative and non-negative numbers in the sorted list, and then filtered the elements to count the positives and sum the negatives. Your approach is more efficient because you don't need to sort the array.Beautiful :)
It does the trick but there are some really concise solutions here with a fraction of the upvotes...
learnes a big lesson
Nice way to evaluate the arr is not empty or None.
good trial
L comment I won't lie
It can also be None according to the kata description, which would then return None and fail.
The function can only return one thing; once it gets to a return statement, the function is done being executed.
Yes you can check mine
I was trying to use recursion but could not. Could anyone explain what is the
return persistence(mult) + 1 is doing here?
Old comment, but if someone runs into a similar issue - are you returning an array of the values or just the values?
My first attempt returned 10,-65 instead of [10,-65] for the first example problem, which fails.
Hi!
Can you please tell me why elif is not needed here? I've seen it a lot in tasks like this when I learned how to code im ny school
Oh not bad using if not
I never thought we could do that
Loading more items...