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.
There already are random test cases though. You might be looking at sample test cases.
That's because simplicity is more valuable than speed. You can always profile and optimize a simple program later if it is too slow. Have you ever tried tried converting a complex codebase into something simple?
This comment is hidden because it contains spoiler information about the solution
@anter69's solution is better than mine, not because it is shorter but because it is simpler. Obsession with speed in irrelevant cases is far more common and troublesome than short == clever mentality.
I'll never understand why beginners try to shoehorn cs101 everywhere. Changing data types doesn't affect Big-O complexity. And trying to speed up things based on general rules without benchmarking just leads to complex and slow code.
Yes, memory allocations take time, but when you are using python, everything takes time. It's a very slow language. Keeping the no. of interpreted steps to a minimum will often outspeed lower memory allocations.
Here's a fun exercise. Try benchmarking my solution and yours.
It's probably a problem with Codewars. I unpublished this and published a new translation.
Description updated.
Meh, I could have implemented it myself, but why do that when a library is provided? It's not like the problem was asking for an implementation of binary search.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
That's an odd error. There's probably a typo or some other mistake in the code you're trying.
This comment is hidden because it contains spoiler information about the solution
Loading more items...