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.
Sorted is O(n log n) complexity, both sorted and sort use the same algorithm behind the scenes. Creating a list is O(1).
i cant tell you how many times i thought about Re but ended up not using it haha beautiful
i had the same idea, just used a string instead :(
This comment is hidden because it contains spoiler information about the solution
i did same thing but i just said arr != None its acccepted too here >1
really nice
brackets denote choosing between a number of characters in regex. in this case, picking one of "a", "e", "i", "o", "u", "A", "E", "I", "O", or "U".
This is wrong. When we do
min
andmax
, there is no sorting happening under the hood, for a total of zero times.Why is it so? I solved with 'min' and 'max' too, but now I think that 'sort' could be more efficient.
When we do 'max' and 'min' - there is some kind of sorting happening under the hood for two times.
But using 'sort' - sorting happens just once.
According to tests from 'pprunesquallor' - 'sort' is more efficient. As you said - only for short lists.
What lists are long? What is the len value after which 'sort' becomes less efficient?
And why?
But didn't it takes more time for slicing, if there is long list? And what if we check "len(arr) > 2" instead of "len(arr) > 1". Wouldn't it be faster?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
An empty list is false(y), so it tests if the list (
arr
) is empty or notWhy 'arr' is used as condition?
Ah, knowing which library to use can make the difference in Python.
Loading more items...