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.
Fixed.
Fixed!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
There's an issue with the description. The input is defined as "Two integers r and c representing the number of rows and columns of the matrix, respectively" but, in the provided example, an input of "11 5" somehow expects the calculation of a 12x6 matrix.
This solution is O(N) in time. The "in-place" solution you are mentioning is O(N/2) which boils down to O(N) too, since 1/2 is just a constant factor.
The true difference between them lies in their space complexities. This one is O(N) in space, although it is simply mutating the input. But the "in-place" is O(1) in space because it does not use any auxiliary memory.
I still prefer this solution though, as you only need to user lower() once and it is very readable overall. Also, memory has become extremely cheap nowadays and it shouldn't be that much of a problem.
This comment is hidden because it contains spoiler information about the solution
I just made a fork of my translation which fixes the problems with rounding. I'm not succeeding on merging it to the original translation. Can somebody help?
The tests expect the array to be sorted by the first element (keys of the hash) in alphabetic order, but the kata description does not mention that whatsoever.
This comment is hidden because it contains spoiler information about the solution
That's because f-strings are a new feature of Python version 3.6.0.
Check out this blog post for more info and considerations on f-strings.
Took me a while to realize I should be using spaces
" "
instead of underscores"_"
.Perhaps the description could be changed to be less misleading in that sense.
If your code is timing out, it doesn't mean that your solution is inappropriate/wrong, but it surely is a sign that your code is inefficient (slow). Very often Katas will be hard because they require you to craft an efficient solution (especially when dealing with large input), although there exists a trivial solution in most cases.
I'm not sure if that was your doubt, but timeout is not a bug, rather it is a constraint to make you think of a better solution.
That would work. However, it is a solution inefficient in terms of memory, as you are creating another list having the same size of the original.
There are better ways, as seen in other people's solutions.
Actually, the correct equivalent would be
if not l
.Loading more items...